measurement_id
- Job
- Identifies the web data stream the event goes to
The GA4 Measurement Protocol sends events to Google Analytics over HTTP from servers and offline systems. Request anatomy, limits and a validation check.
The Measurement Protocol is a set of HTTP endpoints for sending events straight to Google Analytics servers, mainly from servers and offline systems. Google says it is meant to augment gtag, Tag Manager or Firebase collection, not replace it.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
measurement_idapi_secretclient_ideventsname and optional paramssession_id (optional)POST /mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=SECRET HTTP/1.1
Host: www.google-analytics.com
Content-Type: application/json
{
"client_id": "555.1234",
"events": [
{ "name": "level_up", "params": { "level": 5 } }
]
}EU data collection uses the host region1.google-analytics.com. The validation check below exercises the web URL shape shown above.
client_idRELAXED, rejected under ENFORCE_RECOMMENDATIONSvalidationMessages array means none were found. Events sent here do not appear in reports, and the validator does not check your api_secret.To check your real stream, replace the placeholders. Keep the debug path until the response is clean, then switch to /mp/collect for production.
curl -s -X POST 'https://www.google-analytics.com/debug/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=test' \
-H 'Content-Type: application/json' \
-d '{"client_id":"555.1234","events":[{"name":"_badEventName","params":{}}]}'
# prints a validationMessages array with code NAME_INVALID.
# Change the name to level_up and it prints an empty array.2 questions people ask next, answered from the sources on this page.
No. Google says it augments automatic collection through gtag, Tag Manager and Google Analytics for Firebase.
The collect endpoint returns 2xx on receipt and no HTTP error for bad data. Send the same payload to the validation endpoint to see the reason.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.