Google analytics #1554
aalhommada
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
I just found this package , and I think it is usufull // pages/_app.js
import { GoogleAnalytics } from "nextjs-google-analytics";
const App = ({ Component, pageProps }) => {
return (
<>
<GoogleAnalytics trackPageViews />
<Component {...pageProps} />
</>
);
};
export default App; You can pass your Google Analytics measurement id by setting it on the NEXT_PUBLIC_GA_MEASUREMENT_ID environment variable NEXT_PUBLIC_GA_MEASUREMENT_ID="G-XXXXXXXXXX" to your .env.local file |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How could I add google analytics to Nextra ?
or how can I use nextjs script in nextra , is it possible only in _app.tsx instead of Home page , like the nextjs documentation ?
Beta Was this translation helpful? Give feedback.
All reactions