next-fathom
v0.1.0
Published
Add Fathom tracking to Next.js projects that use the App Router.
Downloads
21
Readme
Next Fathom
Next Fathom is a component wrapper
around fathom-client
that allows you to quickly
and easily add Fathom Analytics to your Next.js
projects that use the App Router.
Installation
To install the package using npm
, run the following command in your terminal:
npm install next-fathom
Alternatively, if you are using yarn
, use the following command:
yarn add next-fathom
Usage
In your layout, import and add the Fathom
component, and add your Site ID to the siteId
prop.
This will load the Fathom client and track page views automatically.
import { Fathom } from "next-fathom";
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<Fathom siteId={"MY_FATHOM_ID"} />
{children}
</body>
</html>
);
}
Other methods
This package also re-exports everything from
the fathom-client
package (
e.g. trackPageview
, trackGoal
, etc.). See
the fathom-client
readme
for how to use these.
Referrals
If you’ve not yet signed up you can use my referral link to get $10 credit.