Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Server-side GA4 event not arriving (Measurement Protocol): fix

TRK-367High impactDetectedBy FunnelGuardPublished Updated
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.

Where a server-side event gets lost
  1. Customer convertsOrder or lead confirmed on your server
  2. Server sends eventPOST to /mp/collect returns 204
  3. GA4 processes itBad ID, secret or payload: event dropped
  4. 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.

Conversions recorded vs realExample numbers
Conversions recorded vs real (example)Real sales: 100 conversions per week; Shown in GA4 (events dropped): 60 conversions per week0387710060Real salesShown in GA4 (events …conversions per week

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.

Signs your Measurement Protocol events are not arriving
  • 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.

Validate a payloadbash
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.

Common causes and how to spot them
CauseWhat you see
Wrong measurement_idData 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_secretCreated under the wrong stream, or deleted in Admin
Missing or invalid client_idValidation error, or events are unattributed
Invalid event or param namesNames over 40 characters, reserved names or prefixes such as ga_, firebase_, google_
Malformed JSON or wrong Content-TypeValidation message about the body
Too many events or paramsMore than 25 events per request or more than 25 params per event
Timestamp too oldtimestamp_micros older than the allowed window is dropped
Internal traffic or data filtersEvents arrive but are filtered out of reports

How to fix it

Fix a Measurement Protocol event that is not arriving
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Use recommended event names and params

    For purchases, send purchase with transaction_id, value and currency. For leads, send generate_lead. Mark the event as a key event in Admin > Events if it should count as a conversion.

  6. 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.

Working Node.js example (Node 18+)javascript
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 accepted
Where to set this up on your platform
  1. Server 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.

  2. 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.

How to confirm it's fixed

Confirm the event arrives
  1. Validate

    Run the payload against /debug/mp/collect and check validationMessages is empty.

  2. Send a real test event

    Post the same payload to /mp/collect with a recognisable value, such as a test transaction_id.

  3. 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.

  4. Check later in reports

    Next day, look in Reports > Engagement > Events, and compare totals with your backend count.

How to prevent it happening again

Prevention checklist
  • 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.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: GA4 Realtime arrival.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.