If you’ve been pulling your hair out trying to find the tracking code in Google Analytics 4, I’m going to be your hero.
Steps to generate the tracking code for Google Analytics 4
- Log in to your Google Analytics and navigate to relevant account
- Click “Admin” in the bottom-left corner
- Select “Data Streams” from the second column
- Click on the data stream you have, or create one if you haven’t set one up yet (just follow the prompts)
- In the “Tagging Instructions” section, expand “Global site tag (gtag.js)”
That’s it! There’s your tracking code.
Now I can’t be the only one that was driven completely mad the first time I had to install Google Analytics 4 for someone, simply trying to find the most basic element: the tracking code.
Coming from a decade of working with the older versions of Google Analytics where it was always extremely obvious where to find the code, it was really quite baffling.
Tired of dealing with your slow WordPress website? Email me at email@example.com and mention the code #FreeHosting10 for two free months of lightning-fast WordPress hosting. We will even migrate you for free!
Even more baffling, Google searches for “where is the tracking code in Google Analytics 4” and related searches yielded absolutely nothing useful.
Instead, I was bombarded by 30-minute “quick start” guides for GA4 which somehow didn’t even seem to mention this most-fundamental component.
I may never get an answer as to why any of these things are the way they are, but you now have the tracking code you seek, and it’s not even difficult to get to.