NextJS React Component for Google universal analytics.
npm i --save @eisberg-labs/next-google-analytics
Add this on your page, I'd recommend a pages/_app.tsx
for global access.
export default function MyApp({Component, pageProps}) {
return (
<>
{process.env.NEXT_PUBLIC_ANALYTICS_ID && <GoogleAnalytics ga_id={process.env.NEXT_PUBLIC_ANALYTICS_ID}/>}
<Component {...pageProps} />
</>
);
}
MIT © Eisberg Labs
All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
Note: Version bump only for package @eisberg-labs/next-google-analytics
Note: Version bump only for package @eisberg-labs/next-google-analytics
Note: Version bump only for package @eisberg-labs/next-google-analytics