Using Google Analytics with React/Next.js Projects
@shaaddev
Don't mind me here, I am only creating a quick note.
- Create your own Google Analytics Project
If you haven't done this part before, it as simple as signing up on the Google Analytics page, see link below:
Google Analytics for Developers
- Create your Google Analytics Component
Inside of your components
folder, create a file called google-analytics.tsx
, and add the following:
- Add the secrets into your
.env.local
file
- Add the component to your global component
Inside of app
folder, look for the file that says layout.tsx
and import the component like so:
El fin. :)