LW IT Solutions
« Blog Overview /Digital Analytics / GA4 Measurement Protocol: Server-Side CRM Offline Conversion...
This post in other languages:

GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration

Part 5 of 6 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. 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:

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 standard GA4 Measurement Protocol enforces a strict latency rule. Events sent with a timestamp_micros value older than 72 hours (3 days) in the past may be rejected or dropped by standard real-time processing pipelines.
  • 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.

From pixel to server: tracking that holds

  1. The Evolution of Web Tracking: From Log Files to the Server-Side Future
  2. How to Implement Google Tag Gateway
  3. GA4 & Server-Side GTM: The “Migrate from JavaScript Managed Client ID” Feature Explained
  4. Server-Side GTM on GCP Cloud Run: Architecture, Auto-Scaling, and Cost Optimization
  5. GA4 Measurement Protocol: Server-Side CRM Offline Conversion Integration
  6. 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

Briefly describe your project or inquiry for a tailored response. This site is protected by reCAPTCHA.

2 comments

  1. Sylwester Nowotny

    The recommendation to use webhooks rather than nightly batches follows directly from the 72-hour rule, and it is the part that changes how the CRM side has to be built rather than just the tracking side.

    What I cannot find documented: what happens to an event that fails and gets retried past the window? Our queue backs off for hours on a bad day.

    1. Lukas Wojcik Author

      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.

Write a comment

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

ALL ARTICLES & CATEGORIES

CCTV

Follow this category by RSS

Cloud & AI

Follow this category by RSS

Data Privacy

All 11 articles in this category Follow this category by RSS

Digital Analytics

All 44 articles in this category Follow this category by RSS

Digital Marketing

All 25 articles in this category Follow this category by RSS

IT & Networks

All 15 articles in this category Follow this category by RSS

Raspberry PI

Follow this category by RSS

Smart Home

All 11 articles in this category Follow this category by RSS

Web Development

Follow this category by RSS

WordPress Plugins & Tricks

Follow this category by RSS