{"repo":"derrickreimer/fathom-client","free":true,"listed":false,"github":"https://github.com/derrickreimer/fathom-client","clone":"git clone https://github.com/derrickreimer/fathom-client.git","description":"A Fathom Analytics library to help with client-side routing","language":"JavaScript","stars":174,"topics":["analytics","fathom-analytics"],"license":"MIT","category":"analytics","readme_excerpt":"Fathom Client This library is a JavaScript client for Fathom Analytics. - Asynchronous script loading. We provide a load function that will asynchronously inject the Fathom tag (great for single-page app environments). - import -able tracking functions. We provide tracking functions ( trackPageview and trackEvent ) that you can import and safely call anywhere (even if the Fathom script has not yet finished loading). --- Maintained with ♥️ by the SavvyCal team Installation Run the following to install in your project: Motivation The standard installation flow for Fathom is to drop their snippet on your page, which will automatically load the library and track a pageview. This approach works great for server-rendered sites with full page refreshes, but gets tricky when: - Routing happens on the client-side (e.g. an SPA) - The DOM is abstracted away (e.g. Next.js) This library provides an interface you can use to orchestrate Fathom calls at various points in your page lifecycle: API Reference load(siteId: string, opts?: object) Injects the Fathom script into the DOM and loads the script asynchronously. Arguments - siteId - The site ID provided in the Fathom UI. - opts - An Object of options: - auto - When false , skips automatically tracking page views on script load (defaults to true ). - honorDNT - When true , honors the DNT header in the visitor's browser - canonical - When false , ignores the canonical tag if present (defaults to true ). - spa - Accepts one of the following ","default_branch":null,"files":null,"tree":[],"storefront":"/r/derrickreimer","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/derrickreimer/fathom-client/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}