On this page
What this issue is
The GA4 Measurement Protocol lets your server send events straight to Google Analytics 4 over HTTP, for example a purchase confirmed by your backend or a lead that closed in your CRM. You POST JSON to https://www.google-analytics.com/mp/collect with a measurement_id and an api_secret.
- Customer convertsOrder or lead confirmed on your server
- Server sends eventPOST to /mp/collect returns 204
- GA4 processes itBad ID, secret or payload: event dropped
- Reports and adsConversion missing in GA4 and imported Google Ads goals
The server sees a 204 success, but GA4 never records the event, so reports and ad imports miss the conversion.
Why it costs you leads or sales
Server-side events are often your most reliable conversions, because they do not depend on browsers, ad blockers or consent banners. When they vanish, GA4 under-reports revenue and leads. If you import GA4 conversions into Google Ads, bidding learns from incomplete data and your campaigns can be optimised against the wrong picture.
Example: 100 real sales, of which the server-side events are the only source for 40. If those are dropped, GA4 shows 60.
How to check if your site has it
Start with the symptoms, then test the payload.
- Your server logs show 204 responses but the event is missing in GA4 Realtime
- Purchases or leads in your backend are higher than in GA4
- The event shows in Realtime but not in standard reports after 24-48 hours
- Events arrive but as a separate user, with no link to the web session
- Imported GA4 conversions in Google Ads dropped after a deploy or key change
Now send your exact payload to the validation endpoint. It returns a list of problems instead of a silent 204.
curl -X POST "https://www.google-analytics.com/debug/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"client_id": "123456.7654321",
"events": [{
"name": "generate_lead",
"params": {"value": 25, "currency": "USD"}
}]
}'An empty validationMessages array means the payload is valid. Otherwise each message names the field and the reason. Note that the validation endpoint only checks the payload; it does not send data to your reports.
| Cause | What you see |
|---|---|
| Wrong measurement_id | Data goes to another property, or nowhere. Make sure it starts with G- and is a web or app stream ID, not the property ID |
| Wrong or revoked api_secret | Created under the wrong stream, or deleted in Admin |
| Missing or invalid client_id | Validation error, or events are unattributed |
| Invalid event or param names | Names over 40 characters, reserved names or prefixes such as ga_, firebase_, google_ |
| Malformed JSON or wrong Content-Type | Validation message about the body |
| Too many events or params | More than 25 events per request or more than 25 params per event |
| Timestamp too old | timestamp_micros older than the allowed window is dropped |
| Internal traffic or data filters | Events arrive but are filtered out of reports |
How to fix it
Confirm the measurement ID
In GA4 go to Admin > Data streams, open the web stream and copy the Measurement ID (G-XXXXXXXXXX). Use the same stream your website tag uses if you want events joined to web sessions.
Create or re-copy the API secret
In the same stream open Measurement Protocol API secrets, create a secret and copy its value into your server config. Secrets are per stream.
Send a valid client_id
Pass the web client ID so the event joins the visitor's session. Read it in the browser from the _ga cookie (the last two dot-separated parts) or with gtag('get', measurement_id, 'client_id', callback), store it with the lead or order, then send it from the server. Add session_id in params if you want the event in the same session.
Fix the payload
Run the validation endpoint, then correct each message. Use snake_case event names under 40 characters, avoid reserved names, keep JSON valid and set Content-Type: application/json.
Use recommended event names and params
For purchases, send
purchasewithtransaction_id,valueandcurrency. For leads, sendgenerate_lead. Mark the event as a key event in Admin > Events if it should count as a conversion.Check filters and delays
In Admin > Data settings > Data filters, make sure no filter excludes the traffic. Allow time: Realtime is fast, but standard reports can take hours.
const url = `https://www.google-analytics.com/mp/collect?measurement_id=${process.env.GA_MEASUREMENT_ID}&api_secret=${process.env.GA_API_SECRET}`;
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
client_id: storedClientId,
events: [{
name: 'purchase',
params: {
transaction_id: 'T-1001',
value: 49.0,
currency: 'USD',
engagement_time_msec: 100
}
}]
})
});
console.log(res.status); // 204 does not prove the event was acceptedServer container GA4 client
If you use a server-side GTM container, check the GA4 tag inside it has the right Measurement ID and that the client claims the request. Use Preview mode to see the incoming request.
Capture the client ID
Create a variable that reads the _ga cookie or the GA4 client ID and pass it to your backend with the form or order data.
Check the plugin settings
If a plugin sends server events, re-enter the Measurement ID and API secret in its settings and save.
Custom code
In PHP, use wp_remote_post to the mp/collect URL with a JSON body and a stored client_id, and log the validation response while testing.
Store the client ID
Save the GA client ID as a cart attribute or order note attribute at checkout so your backend or app can send it with the order event.
Check the app
If an app sends purchases to GA4, reopen its GA4 settings and confirm the ID and secret.
Log responses
Send to /debug/mp/collect in staging and log the validationMessages body. Only switch to /mp/collect once it is empty.
Keep secrets server-side
Store the api_secret in environment variables, never in front-end code.
How to confirm it's fixed
Validate
Run the payload against /debug/mp/collect and check validationMessages is empty.
Send a real test event
Post the same payload to /mp/collect with a recognisable value, such as a test transaction_id.
Check GA4 Realtime
Open Reports > Realtime and look for the event name in the event count card. It should appear within a minute or so.
Check later in reports
Next day, look in Reports > Engagement > Events, and compare totals with your backend count.
How to prevent it happening again
- Validate any new or changed payload against /debug/mp/collect before release
- Log the response status and a sample of payloads for every send
- Keep the measurement ID and api_secret in config, and note who owns them
- Store the client_id with each lead or order
- Compare backend conversions with GA4 weekly and investigate gaps
- Re-test after rotating secrets, changing streams or redeploying the backend
How FunnelGuard handles this
FunnelGuard detects this today. It runs your real customer journey on a schedule, such as a lead form or checkout, from the EU or the US, and checks whether the expected event arrives in GA4 Realtime. If the event does not show up, it re-checks from a second region and then sends one alert (email, Slack, Teams, WhatsApp, webhook or PagerDuty) with a screenshot and a likely cause.
This tells you quickly that the conversion is not reaching GA4, so you can run the validation steps above. It does not read your server logs or tell you which field in your payload is wrong. Test traffic is marked with utm_source=funnelguard and fg_test=1, and never enters real card details. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.
Questions people ask
Why is my GA4 Measurement Protocol event not showing up?
The most common causes are a wrong measurement_id, a wrong or deleted api_secret, a missing client_id or an invalid event or parameter name. The production endpoint returns 204 even for bad payloads, so send the same request to /debug/mp/collect to see the exact errors.
Why does Measurement Protocol return 204 but no data appears?
A 204 only means Google received the request, not that it was valid. Invalid events are dropped silently. Use the validation endpoint, which returns validationMessages, to find what is wrong.
How do I debug GA4 Measurement Protocol events?
POST your payload to https://www.google-analytics.com/debug/mp/collect with your measurement_id and api_secret. An empty validationMessages array means it is valid. Then send it to /mp/collect and check GA4 Realtime.
Where do I find the GA4 api_secret?
In GA4 go to Admin > Data streams, open the stream, then Measurement Protocol API secrets. Create a secret there and copy its value. Each secret belongs to one stream.
Why do my server-side events not link to web sessions in GA4?
The client_id you send must match the one the browser uses, usually from the _ga cookie. Add the session_id in params as well if you want the event in the same session. A made-up client_id creates a new user.
How long do Measurement Protocol events take to appear in GA4?
They usually show in Realtime within a minute or so. Standard reports can take several hours to a day. If Realtime stays empty, the event was probably dropped.
Do Measurement Protocol events count as conversions in GA4?
Yes, if the event is marked as a key event in Admin > Events and it is accepted by GA4. Sending the event is not enough on its own to make it a conversion.
Related issues
- TRK-377Server-side endpoint returns 5xx intermittentlyFix guide
- TRK-373Webhook to analytics (Zapier) failing silentlyFix guide
- TRK-376First-party tracking subdomain SSL expiredFix guide
- TRK-369Server events missing client IP / user agentFix guide
- TRK-372Server-side tagging cost overrun shutting containerFix guide
- TRK-368Meta CAPI token expiredFix guide