DocsMeasurement Protocol
Install

Installing Trackingplan for the GA4 Measurement Protocol

Monitor the GA4 Measurement Protocol hits your servers send to Google, through your server-side GTM container or a copy sent to your webhook.

Trackingplan monitors the GA4 Measurement Protocol hits your servers send to Google. You can install it in two ways: through your server-side GTM container, or by sending a copy of each request to your Trackingplan webhook.

These hits never pass through a browser, so the web snippet and the app SDKs do not see them. Pick the method that matches how your backend sends them.

Choose your method

Your backend sends Measurement Protocol hits…Use
to your server-side GTM containerServer-side GTM
straight to google-analytics.com/mp/collectWebhook

Through server-side GTM

If your Measurement Protocol hits go through a server-side GTM container, install Trackingplan in that container. Follow Installing Trackingplan for ssGTM: it covers the Trackingplan tag, the snippet for the tags you want to monitor, custom domains and how to check it in preview mode.

Through the webhook

If your backend sends its hits straight to Google, it also sends a copy of each request to your Trackingplan webhook. Trackingplan identifies which destination sent the data and routes it through the right parser.

  1. Open your install page, https://app.trackingplan.com/plans/YOUR_TP_ID/install, and copy your webhook URL. Webhooks shows where it is.
  2. In your backend, find the code that sends each request to https://www.google-analytics.com/mp/collect.
  3. After that request, send a copy of it to your webhook URL: the same query string and the same JSON body.
  4. Deploy the change.

For example, in Node.js:

const query = `?measurement_id=${MEASUREMENT_ID}&api_secret=${API_SECRET}`;
const body = JSON.stringify(payload);
const options = { method: 'POST', headers: { 'Content-Type': 'application/json' }, body };

await fetch('https://www.google-analytics.com/mp/collect' + query, options);

// the copy for Trackingplan: never let it block or break the request to Google
fetch(TRACKINGPLAN_WEBHOOK_URL + query, options).catch(() => {});

Send the copy after the request to Google, and do not wait for its answer. If the webhook is unreachable, your hits still reach GA4.

Check that it works

Send a test event from your backend. Then open Destinations: your Measurement Protocol hits appear there as one more destination, with their events and properties.

Questions or problems along the way? Contact support.

Was this useful? Write to support@trackingplan.com