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 the relevant account
- Click “Admin” in the bottom-left corner
- Go to Property settings -> Data collection and modification -> Data streams
- Click on the data stream you have, or create one if you haven’t set one up yet (just follow the prompts)
- Scroll down to “View tag instructions” and click it
- Click “Install manually” and copy your tracking code to use wherever you like.
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.
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.
You’re welcome.