How to add Google Analytics to your Next.js application (quick & easy)

In this video I show you how to add Google Analytics to your NextJS application. I show how to add Google analytics to fresh Next JS application created with yarn create next-app.

Sign up for my newsletter: https://tuomokankaanpaa.com/newsletter
Check out my courses: https://tuomokankaanpaa.com/courses

with-google-analytics example repo: https://github.com/vercel/next.js/tree/canary/examples/with-google-analytics
Learn more about _document.js: https://nextjs.org/docs/advanced-features/custom-document

MY GEAR
MY CODIGN LAPTOP: https://amzn.to/3pEQTHq
MY MOUSE: https://amzn.to/3cbdvMD
MY KEYBOARD: https://amzn.to/3dSKQMR
MY MICROPHONE: https://amzn.to/3Ck9jVo
MICROPHONE BOOSTER: https://amzn.to/3R4oplQ
MY MICROPHONE ARM: https://amzn.to/3QTAevg
MY CAMERA: https://amzn.to/3wpw5aq
MY STREAMING LIGHT: https://amzn.to/3cbZBtp

00:00 What is this video about
00:26 with-google-analytics example
00:39 Create gtag.js
01:35 Create Google Analytics account
02:11 Create data stream
02:29 Copy your measurement ID
02:40 Create _document.js with GA code
04:16 Add GA code to _app.js
05:14 Test pageviews
06:12 Send custom event (add to cart)
08:30 Like & Subscribe!

Connect with me:
Website: https://tuomokankaanpaa.com
My newsletter: https://tuomokankaanpaa.com/newsletter
Twitter: https://twitter.com/tumee
Skillshare: https://www.skillshare.com/r/user/tume

#nextjs #googleanalytics #reactjs

Source: https://www.youtube.com/watch?v=uwDFNJ01HxE

Leave a Reply

Your email address will not be published. Required fields are marked *