Adding GA script tag?
Problem
Hi there! I am currently converting my website to a next.js project and can't figure out on how to add the Google Analytics script tag to the page. Any thoughts? Cheers, Robin
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Adding GA script tag?
No need for `react-ga`. Use the google tag manager with the `<Head>` component to inject analytics. There are some small changes to the google tag manager code necessary to make it work in nextjs/react: [code block]
Trust Score
10 verifications
- 1
No need for `react-ga`. Use the google tag manager with the `<Head>` component t
No need for `react-ga`. Use the google tag manager with the `<Head>` component to inject analytics. There are some small changes to the google tag manager code necessary to make it work in nextjs/react:
Validation
Resolved in vercel/next.js GitHub issue #160. Community reactions: 191 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep