scalpel@labs: ~/glossary/ga4-measurement-id.mdx6 sections

What is a GA4 measurement ID?

A GA4 measurement ID, written `G-XXXXXXX`, identifies one Google Analytics 4 data stream. Every hit the page sends carries it as the `tid` query parameter, which is how Google routes the event to the right property.

extension: Scalpel Tagsupdated: 2026-08-14read_time: 2 min
less ga4-measurement-id.mdx

Why it matters

Google Analytics can track many sites and properties. When a hit arrives at Google, it needs to know which property it belongs to. That's the measurement ID's job.

Every GA4 property gets one or more measurement IDs. When you set up GA4 on your site, you get an ID that looks like G-XXXXXXXXXX. Your page includes it in every hit so Google knows where to route the data. Without the ID, Google wouldn't know whether a hit was for your ecommerce site or your blog.

The ID is also how you distinguish between your production site and your staging site. They're both yours, but they have different measurement IDs. That way, test traffic doesn't pollute your real reports.

How it works

You add the measurement ID to your page via the gtag.js snippet:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

The ID appears twice: in the script src and in the gtag('config', ...) call.

When gtag.js fires an event, it adds the ID as the tid (tracking ID) parameter on every request:

GET /g/collect?v=2&tid=G-XXXXXXXXXX&cid=12345&en=page_view

Google's servers read the tid and route the hit to the right GA4 property.

Property versus data stream. One GA4 property can have multiple data streams: web, mobile iOS, mobile Android, or any custom stream. Each stream has its own measurement ID. So if you track both your website and your app, you might use two different G-ids.

Measurement ID versus Universal Analytics ID. The old Google Analytics (Universal Analytics) used UA- IDs like UA-123456789-1. GA4 switched to G- IDs. The formats are completely different, and you can't mix them on the same property.

What does not matter

You don't need multiple measurement IDs for A/B tests or user cohorts. One ID covers all users and all variants. GA4 uses other parameters (like custom dimensions) to segment the data in reports. The ID itself is just the destination.

Also, if you're using Google Tag Manager (GTM), you probably don't put the measurement ID directly in your HTML. The GTM container handles it, and you configure the ID in the GTM interface. The result is the same: every hit carries the tid.

Code example

When you set up gtag.js, the measurement ID is visible in the tag itself:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-A1B2C3D4E5"></script>

In a POST request, it travels as a query parameter:

POST /g/collect?v=2&tid=G-A1B2C3D4E5

Or in a GET request:

GET /g/collect?v=2&tid=G-A1B2C3D4E5&cid=12345&en=page_view

If you're using server-side tagging, you'll send the tid yourself:

fetch('https://www.google-analytics.com/g/collect', {
  method: 'POST',
  body: 'v=2&tid=G-A1B2C3D4E5&cid=12345&en=page_view'
});

Replace G-A1B2C3D4E5 with your actual measurement ID.

How Scalpel Tags shows it

Scalpel Tags displays the measurement ID in the decoded hit parameters. In the DevTools panel, look for the Properties group. The tid parameter shows the full measurement ID. Scalpel Tags also summarises which properties are being tracked on the page.

If a hit is missing a measurement ID, Scalpel Tags marks it as unknown or empty. That usually means gtag.js didn't initialise properly or the tag is using an old Universal Analytics ID.

Sources