Skip to content
Google Analytics 4

What Can the GA4 Measurement Protocol Do?

Definition

The GA4 Measurement Protocol sends events directly to Google Analytics through HTTP requests, usually from a server or an offline system.

It can record interactions that a browser tag does not send, including purchases and refunds. Google designs it to supplement tagging, so a server event still needs the right identifiers and context to connect to the visitor's earlier activity.

request
client_idmeasurement_idapi_secret
Session context
session_idengagement_time_msec
backdated
up to 72 hours

Daniil Maximkin Published Reviewed

  1. In practice

    What can it add, and what can it not recover?

    I use the protocol when the backend knows an event happened and can supply the data GA4 needs. It can connect online and offline behaviour and record server interactions alongside browser events.

    It does not recreate a browsing history that was never collected. Google says it supplements automatic collection through the Google tag, Tag Manager or Firebase. An event with no connection to the original visitor is not evidence that the original session’s attribution has been restored.

    Events can be backdated by up to 72 hours. That is not a way to backfill last month’s missing purchases, and the backdating limit alone does not guarantee session attribution.

  2. In practice

    What are client_id and transaction_id for?

    For a web stream, client_id identifies the user instance and should match the ID generated by the website’s GA4 tag. I carry that value into the backend when permitted, rather than replacing it with an order number or a fresh random value for each purchase. The request also needs the stream’s measurement_id and an api_secret that stays on the server.

    transaction_id identifies the order on a purchase event. Google documents purchase deduplication for web streams, for transactions from the same user with the same transaction ID. I preserve the browser’s client identity and the same order reference in any server copy. A transaction ID alone is not a promise of deduplication across different users or app streams.

  3. In practice

    When does a server event break?

    I look for the wrong stream, a lost client_id, a reused or empty transaction_id, malformed ecommerce parameters, or an event sent with the wrong time. Session context also matters: Google recommends session_id and engagement_time_msec for accurate session and engagement metrics, including Realtime. I use the actual context rather than inventing engagement.

  4. Not to be confused with
    Not to be confused with
    Is notIs
    evidence that the original session's attribution has been restoredsupplements automatic collection
    a way to backfill last month's missing purchasesEvents can be backdated by up to 72 hours

    The collection endpoint returns HTTP 2xx when it receives the request, even if the payload is incorrect or the event is not processed. Transport success, valid event structure and a correctly reported purchase are three different checks.

  5. Where to check

    How do I check a Measurement Protocol event?

    1. Inspect the prepared payload in a test environment. Compare its client identity and order reference with the browser event and backend record; keep the API secret out of logs.
    2. Validate a test payload with /debug/mp/collect and ENFORCE_RECOMMENDATIONS. Review validationMessages; validation events do not appear in reports.
    3. Check the configured stream and secret separately. Structural validation alone does not establish that the credentials are correct.
    4. In a permitted test property, verify the collected event and its parameters, then reconcile the purchase against the backend order. Do not use the HTTP status as the acceptance check.
  6. Sources
Daniil Maximkin

Hi, I’m Daniil.

I work with you from defining the problem to implementation and handover. You talk to the person who does the work. I work in English and Russian.

What do you need to get working?

Describe your task

The first answer is free, within one working day. Or write directly: next@taskfordaniel.com