
Where Is the Google Analytics Tracking Code?
Carlos GarciaPublished Where Is the Google Analytics Tracking Code?
You created a Google Analytics property, you got to the end of the setup wizard, and then the wizard closed. Now you need the actual code, and it is nowhere obvious.
This is one of the most common dead ends in Google Analytics. The code exists, it has not moved, and almost nobody finds it on the first try.
Part of the problem is that the thing you are looking for has three names. Depending on which tutorial you read, you want a tracking code, a Google tag, or a Measurement ID.
Those are not quite the same thing, and which one you need depends entirely on how your site is built. Copying the wrong one is why so many installations silently collect nothing.
This guide covers where the code lives, what the difference between those three names actually is, how to get each one, and where to put it once you have it.
Where Is the Google Analytics Tracking Code? The Direct Answer
Your tracking code lives in the Admin area, not in any report. Go to Admin, find Data streams under Property settings, and click the name of your data stream.
The Measurement ID sits at the top right of that panel, under Stream details. It starts with G- followed by a string of letters and numbers.
For the full code snippet, scroll to the Google tag section near the bottom of the same panel and click View tag instructions, then Install manually.
That gives you the complete block to paste on your site, from the <!-- Google tag (gtag.js) --> comment through the closing </script> tag.
Finding your tracking code is step one. Knowing what to do with the data is the harder part. Get a free SEO audit and see what your analytics should be telling you.
Free audit
Where do you stand in AI search?
A manual SEO + AI search audit of your site: how ChatGPT, Gemini, Perplexity and Claude read and cite it today, and what to fix first. Report within 48 hours, no credit card.
Get my free auditOr have it all done: AI SEO services, $999 once
What "Tracking Code" Actually Means in Google Analytics 4
The phrase "tracking code" is a holdover from Universal Analytics, where there was one snippet and one name for it. GA4 split that into two separate things.
Understanding the split takes about a minute and saves you from the most common installation failure, which is pasting an ID where a snippet belongs.
The Measurement ID
The Measurement ID is a short identifier for one data stream. It looks like G-XXXXXXXXXX and it is the piece most integrations ask for.
If you use Google Tag Manager, a WordPress plugin, Shopify, Squarespace, Wix, or almost any modern CMS integration, this ID is all you need. The platform builds the rest.
One property can have several data streams, each with its own Measurement ID. A site and an app under the same property will not share one.
That matters more than it sounds. If you have both a web stream and an app stream, copying the wrong ID sends your website traffic into an app report.
The Google tag snippet
The Google tag is the actual JavaScript. It is a dozen or so lines that load gtag.js from Google's servers and then initialise it with your Measurement ID.
This is what you need when you are editing your site's HTML directly and have no tag manager or CMS integration doing it for you.
The snippet contains your Measurement ID inside it, which is why people sometimes assume the ID alone will work. On a hand-coded site, it will not.
Why the names are so confusing
Google's own help pages use "Google tag ID" and "Measurement ID" interchangeably for the same copied value, which does not help anybody.
Treat them as one thing: the G- identifier. The phrase "Google tag" on its own, without "ID" after it, usually means the snippet.
The older UA- prefix belonged to Universal Analytics, which stopped processing data in 2023. If a tutorial shows you a UA- code, it is out of date and so is everything else on that page.
How to Find Your Tracking Code, Step by Step
Both routes start in the same place. Budget two minutes.
- Open Google Analytics and check which property you are in. The property selector is at the top of the screen. With several properties on one account, this is the easiest thing to get wrong.
- Click Admin. It is the gear icon in the lower left of the navigation rail, separate from the reports.
- Find Data streams under Property settings. Not Account settings. If you do not see it, you are looking at the account level rather than the property level.
- Click the name of your data stream. Click the name itself, not the arrow beside it, which opens a different panel.
- Copy the Measurement ID from Stream details. It is at the top right, with a copy icon beside it. Stop here if your platform only asked for an ID.
- For the full snippet, scroll to the Google tag section. It is near the bottom of the web stream details panel.
- Click View tag instructions, then Install manually. You will get the complete code block, ready to copy.
If there is no data stream listed at all, nothing has been created yet. Click Add stream, choose Web, and enter your site URL to generate one.
Most sites have analytics installed and still cannot answer basic questions about their traffic. Get a free SEO audit and find out which pages are actually earning search visits.
Where to Put the Code Once You Have It
The Google tag goes in the <head> section of every page you want tracked, as high up as you can reasonably put it.
Loading it in the head rather than before the closing body tag means it fires before a visitor has a chance to leave, which keeps your session counts honest.
If your site uses a shared header template or layout file, adding it there once covers every page. That is the normal approach and the one least likely to drift.
Only one Google tag per page. Two copies of the same tag will double-count pageviews, which is a confusing problem to debug months later.
Do not paste the snippet into a blog post, a widget, or anywhere the content management system might escape the HTML. It needs to render as real script, not as visible text.
When You Only Need the ID
Most people installing analytics in 2026 never touch the snippet at all. The ID is enough in several very common situations.
- Google Tag Manager. Create a Google Tag in GTM, paste the Measurement ID into it, and publish the container. GTM loads the library for you.
- WordPress with an analytics plugin. The plugin has a single field for the ID and writes the header code itself.
- Hosted platforms. Shopify, Squarespace, Wix and Webflow all have a dedicated analytics field in their settings.
- Server-side or app tracking. The Measurement Protocol and the mobile SDKs both identify the stream by ID.
The rule is simple. If something is asking for an ID, give it the ID. Only reach for the snippet when you are editing HTML yourself.
Mixing the two is where double-counting comes from. A plugin installing the tag plus a hand-pasted snippet in the header gives you two tags and inflated numbers.
Limitations and Things That Go Wrong
Finding the code is the easy part. A few things reliably go wrong after that, and none of them produce an error message.
Permissions. You need Editor or Administrator access on the property to see the Admin area in full. With Viewer access, Data streams may not appear at all.
The wrong stream. If a property has multiple web streams, one per subdomain or per region, each has its own ID and the names are often nearly identical.
Caching. On a cached site the new header may not be live for visitors even though it looks correct in your editor. Clear the cache before concluding the tag is broken.
Consent tools. A consent management platform can block the tag until a visitor accepts cookies, which is intentional but looks exactly like a broken installation.
Browser blocking. Your own ad blocker will stop the tag from firing when you test it yourself. This is the single most common false alarm.
Data also takes time. The Realtime report should show you within a minute or two, but the standard reports can lag by 24 to 48 hours on a new property.
Analytics tells you what happened. It does not tell you why your rankings moved. Get a free SEO audit for the search side of the picture.
How This Compares to the Alternatives
You have three realistic ways to get Google Analytics onto a site, and the right one depends on how much else you plan to track.
Pasting the Google tag directly is the fastest path to working data. It is also the least flexible. Every future change means editing your site's code again.
Google Tag Manager costs you an afternoon of setup and then pays it back. Conversion tags, remarketing pixels and event tracking all become configuration rather than deployment.
A CMS integration or plugin is the lowest-effort option and the right default for a straightforward content site. The trade-off is that you are limited to whatever the plugin exposes.
If you are only ever going to install analytics and nothing else, the direct snippet or a plugin is fine. If you expect to add a second or third tag, start with Tag Manager.
One thing worth noting: none of these three options is better at collecting data. They all end up loading the same library with the same Measurement ID.
Frequently Asked Questions
Can I find my Measurement ID without Admin access? Not reliably. You can sometimes read it out of your own site's page source, since the ID appears in the rendered snippet.
What if my ID starts with AW- instead of G-? That is a Google Ads conversion ID, not a GA4 stream. You are in the wrong product's settings.
Does the code expire? No. A Measurement ID stays valid for the life of the data stream. Deleting and recreating a stream does generate a new one.
Can one snippet cover several properties? The modern Google tag can send to more than one destination, but configuring that is a Tag Manager job rather than a copy-paste one.
Final Thoughts
The code has not moved and it is not hidden. It is in Admin, under Data streams, inside the stream itself, and it has been in that location for the whole life of GA4.
Decide which of the two things you actually need before you go looking. An ID for anything that asks for an ID, the full snippet only when you are editing HTML yourself.
Once it is installed, the next question is whether it is working, and that is a genuinely different task. Our guide to checking your Google Analytics tags covers how to confirm the tag is firing before you trust a single report.
Then turn your ad blocker off before you panic. It explains more broken installations than every other cause put together.
Working analytics is the floor, not the ceiling. Get a free SEO audit and see which pages deserve the traffic you are measuring.
Want this done for you?
SEO Stuff gets businesses cited by ChatGPT, Gemini, Perplexity and Claude, and ranking in Google. Start with the free audit, a call, or the package.
See where you stand
A free, manual SEO + AI search audit of your site, with a report within 48 hours. No credit card, no sales call.
Get my free auditTalk it through
A free 15-minute call with the founder about whether AI search is a meaningful opportunity for your business.
Free strategy callHave it done
The Done-For-You Package: audit, 10 pages of content, 3 DR50+ placements, dashboard. $999 once, delivered in 21 business days.
See the package

