NOTE-037 · FIELD NOTE FILED 14 NOV 2026 · REVISED 14 NOV 2026 F-204 F-102 F-601
GA4 Measurement Protocol: when to use it and the mistakes that break your data.
ABSTRACT — The Measurement Protocol sends events to GA4 over HTTP from a server or any system that has no browser: offline sales, refunds, CRM stages. It adds to your tag, it does not replace it. The three places I check first when it misbehaves: the client_id, the session_id and the timing.
Baris Asa, tracking consultant, London · Last checked: 14 November 2026
The GA4 Measurement Protocol is a way to send events to Google Analytics from a server or any system with no browser: a refund, an offline sale, a CRM stage change. Use it for what the browser tag cannot see. It adds to your tag; it does not replace it. When MP events misbehave, the three places I check first are theclient_id, the session_id and the timing.
Do you use it? If a developer, your CRM, a refund script or a connector tool sends orders, refunds or leads to GA4 without a browser, yes. If you only have the GA4 tag (or Shopify’s GA4 app) and nothing else sends data, no, and a mismatch between GA4 and your shop is a different problem: start with GA4 revenue vs Shopify.
What it looks like when it breaks: server-sent sales or refunds sitting under “(not set)” or Unassigned, refunds on the wrong day, revenue higher than the shop’s, or events that never appear. For “(not set)”, the fix is to send the session_id of the original visit with each event. For events that never appear, validate the payload first (section below).
Two terms you will see. client_id is the anonymous ID GA4 gives each browser. session_id is the ID of one visit. The server has to send both back, copied from the browser.
No partnership, affiliate or commission arrangement with Google or any tool named here.
What is the Measurement Protocol?
Google’s description: it “enhances measurement for web and app streams” by sending events directly to Google Analytics servers over HTTP, for server-to-server and offline interactions. Its stated intent is “to augment automatic collection”, not to replace it (Google: Measurement Protocol (GA4)).
What that means:
- You must still have a tag. Google says you must use tagging (gtag.js, Tag Manager or Firebase) to use the protocol.
- Nothing is automatic. gtag.js collects page views and enhanced measurement events for you. With the protocol you program every event, and rules that create or rename events in the GA4 interface do not fire on MP events.
- Full server-only use gives partial reporting. Google says it may. Without a matching browser visit, device information defaults to desktop for web streams.
When should I use it?
Use it when the thing you want to record happens somewhere the browser does not reach. Google lists connecting online and offline behaviour, events outside normal user interaction such as offline conversions, and devices with no automatic collection, such as kiosks.
| Situation | MP a good fit? | Note |
|---|---|---|
| Refund processed in the shop’s back office | Yes | Refunds in GA4 |
| Lead becomes a booked deal in the CRM | Yes | CRM deal back to GA4 |
| Payment confirmed by webhook, buyer never returned | Yes, with care | GA4 vs Stripe; for trials, subscription and trial tracking |
| Page views and clicks on your website | No | The tag does this and does it better |
| Replacing a broken browser purchase event | Not first | Fix the tag first, F-103 |
| Sending the same events on from a server container | Not this | Server-side GTM has its own path, below |
| Offline conversions for Google Ads | Not the usual route | Google Ads has its own import: offline conversion tracking |
Google also has a newer Data Manager API that ingests events, including to Google Analytics. Its events page says part of that (using it as an additional data source for tag events) is available only to properties on an allowlist, and it does not mention the Measurement Protocol, so I treat the two as separate routes. Check it before you build a new pipeline (Google: Data Manager API events).
On the server-side GTM row: Google’s troubleshooting guide says server-side tagging does not send events to the Measurement Protocol endpoint. Events go to your container, which lacks some features such as deriving geography and device. Separate route: server-side tracking explained.
What does a request need? (for your developer)
Only POST is supported, to https://www.google-analytics.com/mp/collect. For EU collection Google says to use region1.google-analytics.com as the host (Google: sending events).
| Piece | Where | What it is |
|---|---|---|
measurement_id | URL | The G- ID of the web data stream |
api_secret | URL | Stream-specific, private, never in page code. Create it in the stream settings. |
client_id | JSON body | Should match the ID the GA4 tag generated for that browser |
events | JSON body | Up to 25 per request, up to 25 parameters each |
session_id | Event params | Ties the event to an existing session; Google’s reference says it must be a positive number, so copy it as the tag gave it |
engagement_time_msec | Event params | Milliseconds since the previous event; Google asks for a positive value (with debug_mode) to see an event in DebugView |
Names are limited to 40 characters (letters, digits, underscores, starting with a letter), and the body must be under 130 kB. Apps use firebase_app_id and app_instance_id instead.
A refund sent from a back office, as a worked shape (the ID values are placeholders):
POST https://www.google-analytics.com/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=<secret>
{
"client_id": "<client_id captured on the site>",
"events": [{
"name": "refund",
"params": {
"transaction_id": "<order number>",
"value": "<refund amount>",
"currency": "GBP",
"session_id": "<session_id captured on the site>",
"engagement_time_msec": 100
}
}]
}
Add "debug_mode": true to params only while testing. Google’s events reference has a refund example; check it for the current required fields.
The mistakes that break it
Each one starts with what you will see in your reports.
1. A client_id that does not match the browser
You will see: server events counted as new users, with country and device (not set) or defaulted. Google says client_id should match the ID the tag generated. If it does not, the server event is a new visitor: it cannot inherit that visitor’s device, location or earlier history. The ID has to be captured while the visitor is on your site. Google’s gtag reference documents the call: gtag('get', 'G-XXXXXXXXXX', 'client_id', callback), with session_id also supported for GA4 (Google: gtag reference). Google’s reference documents the gtag call only; it gives no separate recipe for Tag Manager, so check your container’s setup with whoever built it. Store both with the order, the lead or the booking. A server running weeks later cannot recover them.
2. No session_id, or an invented one
You will see: the sale under (not set) / (not set) or Unassigned, or a session with no source. For session attribution Google says to include session_id and send within 24 hours of the session start, with a timestamp inside the session. (Google: use cases). The sending-events page adds that creating a new session_id creates a new session without a session_start event (Google: sending events). So a fresh ID means a fresh session with no source to inherit. Where I look first: whether the developer generated a new ID because the field was required, instead of copying the visit’s.
Three time limits show up on this page, and they are different things: 24 hours is how long after a session starts Google says to send an event to attribute it to that session; 48 hours is Google’s advice for joining a client-side event; 72 hours is the backdating limit.
Google’s help page gives the repair for sessions reported as “(not set) / (not set)”: send the session_id with a valid value from the client-side event, which connects the server data to the attribution the tag already collected (Google Analytics Help: Measurement Protocol).
Not every unassigned MP event is a fault. A subscription renewal charged with no visit behind it has no session to join. Google’s page gives only the session_id repair; Analytics Mania, a third-party source, describes that case as expected (Analytics Mania: Unassigned in GA4). Google’s tagging page for unassigned and (not set) adds that manually modifying client_id or session_id can dissociate events from their sessions, and that inconsistent cookie_prefix values can cause (not set) (Google: avoid unassigned and (not set)). That page is about the tag’s own settings, not the Measurement Protocol, but the same ID-mismatch logic applies. For the other kinds of Unassigned, see Unassigned traffic and F-204 .
3. Sending too late
You will see: refunds or CRM sales stamped on the wrong day, or conversions that never attribute. Google lets events be backdated up to 72 hours. Older than that and the event is accepted with its time set to 72 hours ago (the default, RELAXED), or rejected under ENFORCE_RECOMMENDATIONS. For events meant to join a client-side event, Google says to send within 48 hours of the original timestamp, or they may not be processed as expected, especially for conversion attribution (Google: sending events, override timestamp). A weekly CRM export does not fit. A refund processed ten days later is stamped to the wrong day, and the refunds note covers what to do.
4. Counting the same sale twice
You will see: GA4 revenue higher than the shop’s. If the browser tag sent the purchase and your server sends it again, GA4 can count revenue twice. The key is transaction_id: GA4 deduplicates purchase events that share one (Google’s transaction ID help). That page does not discuss the Measurement Protocol specifically, so test it with one order. Never send an empty transaction_id, and never reuse one across different customers. The duplicate path is in purchase fires twice. Dedup keys differ by platform: Google uses transaction_id, Meta uses event_id (F-102). One sender per event, or one shared ID.
5. Parameters nobody registered
You will see: the event in Realtime but a custom field missing from reports. An MP event can carry any parameter that obeys the naming rules, but a custom parameter still has to be registered as a custom dimension or metric before it appears in standard reports. That is F-601 , explained in custom parameters not showing.
6. The secret in the wrong place
You will see: events you did not send. Google says api_secret is private and should not be exposed in client-side code. Anyone holding it can send events to your property. If it has leaked, create a new one, update every sender, confirm events still arrive, then delete the old one (handover note).
How do I check it works?
The live endpoint will not tell you. Google’s validation page says the protocol does not return HTTP error codes, even if an event is malformed, so a success response proves little.
Non-technical check, five minutes: pick one real order the server sent. Find the browser visit that produced it, and compare source, device and country for that order in GA4. If the server copy shows “(not set)”, go to mistakes 1 and 2.
Ask your developer: which events do we send by Measurement Protocol? Do they carry the client_id and session_id of the original visit? How old are they when sent?
Developer steps:
- Validate. Send the same JSON to
https://www.google-analytics.com/debug/mp/collect. The response has avalidationMessagesarray, empty if the event is fine, withfieldPath,descriptionand avalidationCodesuch asNAME_RESERVEDorVALUE_INVALID(Google: validating events). - Know what that check skips. The validation server does not validate
api_secretorfirebase_app_id, and events sent to it never reach your reports. A clean result means well-formed, not delivered. - Send it live. Put
"debug_mode": trueand a positiveengagement_time_msecin the event’sparams. Check Reports, Realtime, then DebugView. Google says Realtime typically shows events within a few seconds (Google: verify your implementation). - Take
debug_modeout before production. DebugView mechanics: DebugView is empty.
Consent and privacy
If you omit consent, Google says Analytics uses the consent settings from the matching online interactions for that client. You can send ad_user_data and ad_personalization as GRANTED or DENIED (Google: reference). Sending events about people who declined on the website is a legal question as well as a technical one, and I am not a lawyer. Passing the consent state with the event is also what lets Google treat it correctly, so it is more than a compliance step. The sensible default is to send server events only for people whose consent you hold, and to pass that state along.
Who sets this up?
A GA4 specialist who works across the tag, the shop and the CRM. If the checks above show “(not set)”, the fix is a change on the site (capture the IDs) and in the sender, usually a small job. Send me the sender’s name and one order number and I will tell you which of the six it is. My GA4 consultant page says what that covers. Agencies can bring me in under their own name through white-label.
Sources
Read on 14 November 2026:
- Google for Developers, Measurement Protocol (GA4): overview, sending events, use cases, validating events, verify your implementation, troubleshooting, reference
- Google for Developers, gtag.js reference (
getforclient_idandsession_id) - Google for Developers, Data Manager API events
- Google Analytics Help, avoid unassigned and (not set)
- Google Analytics Help, Measurement Protocol and transaction ID
- Analytics Mania, Unassigned in GA4 (subscription renewals as an expected case)