Server-side measurement into Google Analytics 4 via the Measurement Protocol needs two values: the Measurement ID and an API secret. Both are right in GA4. Here's where.
Measurement ID (G-…)
The Measurement ID identifies your data stream. Find it like this:
- 1. In GA4, open Admin (the gear icon, bottom left).
- 2. In the property column, choose Data Streams.
- 3. Click your web stream.
- 4. Top right you'll see the Measurement ID in the form
G-XXXXXXXXXX.
API secret (Measurement Protocol)
The API secret authorizes sending events from the server. Create it in the same data stream:
- 1. In the web stream details, find the Measurement Protocol API secrets section.
- 2. Click Create and name the secret (e.g. "server-side").
- 3. GA4 generates the secret value — copy it. It's used together with the Measurement ID for server-side sending.
Things to watch
- The API secret is sensitive — treat it like a password, never expose it in client-side code.
- The Measurement ID (G-…) isn't the old Universal Analytics UA-… ID, nor the Stream ID (a number).
- After setup, verify in GA4 DebugView that events arrive.
How to use both values during setup is in the GA4 server-side docs. If conversions don't arrive, see GA4 not showing server-side conversions.