GA4 Measurement Protocol Builder

Build and validate GA4 Measurement Protocol payloads — useful for server-side events, offline imports, and CRM-to-GA4 pipelines.

Inputs

The GA4 cookie value (_ga). For server-side, generate or look up.

Use dot/bracket notation for nesting: items[0].item_id.

Payload (POST body)

{
  "client_id": "1234567890.1620000000",
  "events": [
    {
      "name": "page_view",
      "params": {
        "page_location": "https://example.com",
        "page_title": "Home"
      }
    }
  ]
}

cURL command

curl -X POST "https://www.google-analytics.com/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=YOUR_API_SECRET" \
  -H "Content-Type: application/json" \
  --data '{"client_id":"1234567890.1620000000","events":[{"name":"page_view","params":{"page_location":"https://example.com","page_title":"Home"}}]}'

Validation tip: Append ?validation to the URL hostname (/debug/mp/collect) to test before sending real events.

Want server-side GA4 piped from your CRM?

We build offline-conversion pipelines that fire deterministic GA4 + Google Ads events from your CRM, with retries and dedup baked in.

INTERACTIVE DEMO Want to test how this tool works?
Save these results as a PDF report A clean, branded copy to share with your team or client.
Free PDF report

Where should we put your name on the report?

Your PDF downloads straight away. Your tool data never leaves your browser.

Jobair Mahmud, Web Analytics & Tracking Architect
Tool Creator

Jobair Mahmud

Founder & Tracking Architect

100% Top Rated
★★★★★
5.0 / 5.0

Need backend events in GA4?

I connect your backend, CRM or checkout to GA4 with the Measurement Protocol or server-side GTM, with clean IDs so nothing is double counted.

Get backend tracking set up →

How to use the GA4 Measurement Protocol Builder

The GA4 Measurement Protocol lets your server send events straight to GA4, for example a purchase confirmed by your backend or a lead qualified in your CRM. This builder creates a correctly structured request so you can test it before writing code.

Step by step

  1. Enter your Measurement ID (G-XXXX) and choose the event, such as purchase or generate_lead.
  2. Add the client_id from the visitor's _ga cookie so the event joins their existing session and attribution.
  3. Fill in the event parameters (transaction_id, value, currency, items) and copy the generated payload.
  4. Send it to the validation endpoint first, then send a real test event and check it in GA4 DebugView.

How to read your result

Validation passes and event shows in DebugView

The payload and credentials work. Move the request to your server code.

Validation passes but nothing in GA4

The validation endpoint does not check your API secret. Check the secret, the Measurement ID and add debug_mode while testing.

Event arrives without attribution

The client_id is missing or made up, so GA4 can't join the event to the visitor's session. Capture the real _ga value.

Common mistakes

  • Putting the API secret in browser JavaScript, where anyone can read it. Keep it on the server.
  • Sending a purchase from both the browser and the server without the same transaction_id, which doubles revenue.
  • Forgetting currency on revenue events.

Questions

Measurement Protocol or server-side GTM?

Measurement Protocol is ideal for backend events like CRM stages or confirmed orders. Server-side GTM is better for routing all website events to several platforms.

Can I send events for past dates?

Measurement Protocol accepts a timestamp, but only within a short window in the past, so send events promptly.

Need backend events in GA4?

I connect your backend, CRM or checkout to GA4 with the Measurement Protocol or server-side GTM, with clean IDs so nothing is double counted.