LW IT Solutions logo LW IT Solutions logo LW IT Solutions
« Blog Overview /Digital Analytics / GA4 Measurement Protocol: Server-Side CRM Offline Conversion...
Read this article in other languages:

GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration

Part 4 of 5 in the series From pixel to server: tracking that holds

GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration
Contents
  1. GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration
  2. 1. The Identity Resolution Architecture: client_id, session_id, and user_id
  3. 2. Structuring the HTTP POST Payload
  4. 3. Managing Attribution Delays and Timestamp Constraints
  5. Summary
  6. Questions and answers
  7. Sources

GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration

Connecting offline conversions from CRM and POS systems with online user journeys represents a cornerstone of enterprise digital analytics. Relying solely on browser-based tracking leaves conversion data incomplete whenever sales close via phone, email, or in physical retail stores. Utilizing the Google Analytics 4 (GA4) Measurement Protocol enables direct, server-to-server HTTP POST requests that bridge this gap and attribute revenue accurately to original marketing touchpoints.

Three cards for client_id, ga_session_id and user_id showing where each identifier comes from, what it achieves and what happens when it is missing, plus the endpoint and credentials the request needs
The first identifier decides whether the conversion is counted, the second whether the campaign gets the credit.

1. The Identity Resolution Architecture: client_id, session_id, and user_id

Flawless attribution requires precise identity resolution. When sending offline events via Measurement Protocol, GA4 must link incoming backend payloads to an existing web session. This relies on three foundational parameters:

  • client_id (Required): The anonymous browser identifier generated by the GA4 cookie (_ga). This value must be captured during form submissions and stored persistently within CRM lead records.
  • session_id (Crucial for Session Attribution): Passing only the client_id attributes an offline conversion to the user, but GA4 will often categorize the traffic source as Unassigned or create a synthetic direct session. To inherit the original traffic source (e.g., Google Ads, Organic Search), the numeric ga_session_id must be captured from the browser and passed inside the params object.
  • user_id (Optional, Cross-Device): When authenticated user systems are active, passing a permanent internal database ID enables cross-device journey stitching across web, mobile apps, and offline POS transactions.

2. Structuring the HTTP POST Payload

Server-side transactions must be transmitted to the official collection endpoint: https://www.google-analytics.com/mp/collect. Authentication requires a valid api_secret generated inside the GA4 data stream settings along with the measurement_id in the format G-XXXXXXX.

The following JSON payload illustrates a compliant offline purchase event containing all required attribution parameters:

HTTP
POST /mp/collect?measurement_id=G-XXXXXXX&api_secret=abc123XYZ HTTP/1.1
Host: www.google-analytics.com
Content-Type: application/json

{
  "client_id": "1234567890.1700000000",
  "user_id": "CRM_LEAD_998877",
  "timestamp_micros": "1723795200000000",
  "non_personalized_ads": false,
  "events": [
    {
      "name": "purchase",
      "params": {
        "session_id": "1700000000",
        "transaction_id": "CRM_INV_2026_0891",
        "value": 1499.00,
        "currency": "EUR",
        "engagement_time_msec": 100,
        "items": [
          {
            "item_id": "SKU_ENTERPRISE_PLAN",
            "item_name": "Enterprise Service License",
            "price": 1499.00,
            "quantity": 1
          }
        ]
      }
    }
  ]
}

3. Managing Attribution Delays and Timestamp Constraints

Offline CRM transactions rarely occur instantly. Sales cycles often span days or weeks after the initial website inquiry. Handling attribution delays correctly requires adhering to GA4 processing limitations:

  • The 72-Hour Window: The Measurement Protocol enforces a strict latency rule, and its edge is exact rather than approximate. Measured against the validation endpoint on 9 September 2026: a timestamp_micros value 71 h 59 min 55 s in the past was accepted, and exactly 72 h 00 min 00 s was refused with VALUE_INVALID. The production endpoint answers 204 to both, so at the moment of sending a rejected event is indistinguishable from an accepted one.
  • No tolerance toward the future: A timestamp ahead of the current second is refused as well, and far more sharply than the error text suggests. The message names 15 minutes, but every forward offset tested was refused, down to five seconds — with the sending machine’s clock within 0.8 seconds of the Date header Google returned in the same run. A CRM host or a till whose clock runs fast therefore produces events that are dropped, with nothing anywhere to show for it.
  • The client_id format is enforced: the value has to look like <number>.<number>. A record identifier placed directly in that field — a lead number, a hash prefix, or a plain integer — is refused with has invalid format. Where no _ga value was captured, only a value derived from the record and shaped to that pattern will pass.
  • Real-Time CRM Webhooks vs. Nightly Batches: Due to the 72-hour constraint, relying on weekly or monthly batch uploads is discouraged. Implementing event-driven webhooks inside CRM systems (e.g., triggering a POST request immediately when an opportunity stage changes to Closed Won) ensures timestamps remain fresh and valid.
  • Historical Lookfill via BigQuery: For complex B2B sales cycles exceeding 72 hours, data integration should occur downstream within Google Cloud BigQuery. Joining historical CRM transaction tables directly with raw events_* web data using client_id and lead creation timestamps provides 100% attribution accuracy without API time limit restrictions.

Summary

Integrating offline CRM conversions via the GA4 Measurement Protocol transforms reporting precision. Ensuring that client_id and session_id are stored during lead capture, formatting structured JSON payloads, and transmitting events within the 72-hour window guarantees reliable cross-channel attribution.

Questions and answers

What happens to a Measurement Protocol event that is retried until it falls outside the 72-hour window?

It is not processed, and nothing says so. The Measurement Protocol endpoint answers with a success status regardless of what it does with the payload — there is no rejection to catch, no error body to log, and a retry loop will happily keep succeeding on events that no longer land anywhere.

That has two consequences for the client. The window has to be treated as a hard expiry inside the client itself: an event older than the limit is dropped deliberately and counted, rather than retried until the queue drains. And the counter of dropped events is the actual health signal for the integration, because the transport layer will never produce one.

The one place where validation exists is the debug endpoint, /debug/mp/collect, which returns the validation messages the normal endpoint withholds. It belongs in the test suite of the pipeline rather than in production traffic — a malformed payload that silently succeeds in production is otherwise indistinguishable from a correct one until someone notices the reports are missing revenue.

From pixel to server: tracking that holds

  1. The Evolution of Web Tracking: From Log Files to the Server-Side Future
  2. GA4 & Server-Side GTM: The “Migrate from JavaScript Managed Client ID” Feature Explained
  3. Server-Side GTM on GCP Cloud Run: Architecture, Auto-Scaling, and Cost Optimization
  4. GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration
  5. Meta Conversions API: Maximizing Event Match Quality (EMQ) and Deduplication
Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in touch

A question or an idea for a web project? Tell me a little about it. This form uses reCAPTCHA to protect against spam.

Write a comment

Differing figures from other accounts and questions about the setup are welcome here.

The email address is not published. Required fields are marked with an asterisk.