---
title: "GA4 Measurement Protocol: Send CRM Revenue Back to Analytics Without Breaking Attribution"
description: Backend and CRM events vanish from GA4 unless you stitch them to the original session. Here is how to send closed-won revenue through the Measurement Protocol with correct identity, deduplication, and validation.
author: LETSGROW Dev Team
date: 2026-10-27
category: Analytics
tags: ["GA4", "Measurement Protocol", "Attribution", "CRM Integration", "Server-Side Tracking"]
url: "https://letsgrow.dev/blog/ga4-measurement-protocol-crm-revenue-attribution"
---
Your GA4 property only knows what the browser tells it. Every deal that closes in your CRM, every subscription renewal, every refund and every phone-call booking happens somewhere gtag.js will never see. The result is a conversion report that stops at the form fill and calls it revenue. The fix is not another tag. It is the GA4 Measurement Protocol, and most B2B teams either skip it or implement it so loosely that the data is worse than nothing.

This is a technical how-to for sending CRM and backend events into GA4 so they attach to the original user session, pass validation before they ship, and show up in reports you can trust.

## Why Backend Events Disappear Without Identity Stitching

The Measurement Protocol is a plain HTTPS endpoint. You POST JSON to `https://www.google-analytics.com/mp/collect` with your `measurement_id` and `api_secret` as query parameters, and GA4 records the event. Sending it is trivial. Getting GA4 to connect that event to a real person is where teams fail.

GA4 stitches events by `client_id` (and `user_id` if you set one). If your backend invents a fresh `client_id`, GA4 creates a brand new user with a single event and no source, no medium, no campaign. Your closed-won revenue lands in "(direct) / (none)" and your paid channels look like they never produced a dollar.

The rule is simple: capture the identifier at the moment of the form fill, store it with the lead, and replay it when the backend event fires. That means three fields saved on the CRM record:

- `client_id`, read from the `_ga` cookie (the last two dot-separated segments)
- `session_id`, read from the `_ga_<MEASUREMENT_ID>` cookie
- the lead's hashed email as your `user_id`, if you have consent to use one

::compare-table
columns: ["Approach", "Attribution Survives", "Setup Effort", "Failure Mode"]
rows:
  - ["Fresh client_id per backend event", "No", "Low", "Revenue lands in direct / none"]
  - ["Stored client_id from _ga cookie", "Yes, to original source", "Medium", "Cookie blocked or expired before form fill"]
  - ["Stored client_id plus session_id", "Yes, inside the original session", "Medium", "Events older than the session window fall back to user-level"]
  - ["user_id from hashed email", "Yes, across devices", "Higher", "Needs consent and a stable identity key"]
::

## The Payload That Actually Works

Here is a minimal, correct request for a closed-won event. Notice what is included: the stored identifiers, a real transaction ID, and `engagement_time_msec`. That last field matters. Without it, GA4 often drops the event from session-scoped reports.

```json
{
  "client_id": "1234567890.1700000000",
  "user_id": "a1b2c3hashedemail",
  "timestamp_micros": 1790000000000000,
  "events": [{
    "name": "purchase",
    "params": {
      "session_id": "1790000000",
      "engagement_time_msec": 100,
      "transaction_id": "crm-deal-48213",
      "value": 18500,
      "currency": "USD"
    }
  }]
}
```

Three details trip people up. First, `timestamp_micros` can backdate an event, but only up to 72 hours, so a deal that closes weeks after the form fill needs a different approach: send it with the current time and rely on `client_id` and `user_id` for attribution rather than the session. Second, `transaction_id` is your deduplication key. Reuse the CRM deal ID and a retry will never double count revenue. Third, event and parameter names are case sensitive and capped at 40 characters, and silent truncation will quietly wreck your custom dimensions.

## Validate Before You Ship, Not After

The production endpoint returns a 204 no matter what you send. A malformed payload, a wrong measurement ID and a perfect request all look identical. That is the single most dangerous property of this API, and it is why teams run broken pipelines for months.

Use the validation endpoint, `https://www.google-analytics.com/debug/mp/collect`, with the same body. It returns a `validationMessages` array that names the exact field that failed. Put it in your CI pipeline: every payload builder gets a test that posts a fixture to the debug endpoint and fails the build if `validationMessages` is not empty.

After validation passes, confirm delivery in DebugView by adding `debug_mode: 1` to your event params in a staging stream. Then check Realtime for the event. Only then point the code at production.

::checklist
title: Measurement Protocol Launch Checklist
items:
  - "Store client_id and session_id from GA4 cookies on the CRM record at form submit"
  - "Keep api_secret server-side only, never in front-end code or a public repo"
  - "Use the CRM record ID as transaction_id so retries cannot double count"
  - "Include engagement_time_msec on every event"
  - "Post fixtures to the /debug/mp/collect endpoint in CI and fail on any validation message"
  - "Verify the event in DebugView on a staging stream before production"
  - "Mark the backend event as a key event in GA4 and confirm it appears in acquisition reports"
  - "Document the 72 hour backdating limit for sales ops so late-closing deals use the fallback"
::

## What To Do This Week

Start with one event: closed-won. Add two hidden fields to your lead form that capture `client_id` and `session_id` from the cookies, map them to CRM properties, and write a small function that fires the purchase event when a deal stage changes. Validate it against the debug endpoint, ship it to a staging stream, and compare ten real deals against what Salesforce or HubSpot says.

If the revenue shows up under the right channel, you have just fixed the most common blind spot in B2B attribution with about a day of engineering. If it lands in direct, your identifier capture is broken, and now you know exactly where to look.

The Measurement Protocol is not glamorous. It is a POST request. But it is the difference between a GA4 property that reports on clicks and one that reports on revenue.