DocsServer-Side
Install

Installing Trackingplan Server-Side

Install Trackingplan for data sent from servers, not browsers, with Segment and Amplitude webhooks, GA4 Measurement Protocol hits and server-side GTM.

Some of your data never passes through a browser or an app: a CDP forwards your events, your backend sends GA4 Measurement Protocol hits, or your server-side GTM container sends requests on behalf of your site. For these, install Trackingplan on the server side.

In this section:

Segment, Amplitude and GA4 Measurement Protocol each have their own webhook URL in the Webhook tab of your install page: the URL tells Trackingplan how to read the data, so use the Segment URL only in Segment, the Amplitude URL only in Amplitude, and the GA4 Measurement Protocol URL only for copies of those hits.

Installing Trackingplan as a Segment Destination

Your install page (https://app.trackingplan.com/plans/YOUR_TP_ID/install) generates your Trackingplan Segment webhook URL for you. Open the Webhook tab and, under Segment, click Copy. You'll need it in a later step.

The Webhook tab of the install page
The Webhook tab of the install page

To create and set up a new Webhook (Actions) destination, follow these steps:

  1. Log in to your Segment account and your workspace.
  2. On your Catalog page, search for "Webhooks Actions" and click on the Webhooks (Actions) destination you’ll see in your search results.
  3. Click the Add destination button.
  4. Pick the source you’d like to use with Trackingplan. To add more than one source, repeat this process. Then click Next.
  5. Name your destination (e.g. Trackingplan), select Fill in settings manually (default), and, to finish this step, click on Create Destination.
  6. Next, select the Mappings tab for your destination and click on New Mapping.
  7. Click on Send when to define the streaming behavior.
  8. Next, in Define event trigger configure a rule to define what events will be sent.
  9. Skip the Linked Events step and go straight to Map fields. Configure them using the following settings.
    1. URL: set the Webhook URL from the /install page of your plan (see above).
    2. Batch size: input a batch size of 100.
    3. Enable Batching: set it to Yes
  10. Save your settings and enable the destination on the Settings tab.
  11. Finally, click on the Delivery Overview tab to check if tracks are being sent correctly.

All set. Questions or problems along the way? Contact support.

Installing Trackingplan in Amplitude CDP

Your install page (https://app.trackingplan.com/plans/YOUR_TP_ID/install) generates your Trackingplan Amplitude webhook URL for you. Open the Webhook tab and, under Amplitude, click Copy. You'll need it in a later step.

With it, you create a new Webhook Destination in your Amplitude Data account, add your Trackingplan Endpoint as the URL and make sure the filter includes all events. Here is the process step by step:

  1. Log in to your Amplitude account and go to the Data section of your dashboard:
  2. Click on Connections → Destinations → Add Destinations
  3. Select Webhook from the Catalog
  4. Set a name to identify the connection (e.g.: Trackingplan).
  5. Add your Trackingplan Webhook URL, select All events at the events filter, and enable the Destination.
  6. Click Save and confirm with Send Event & Save.

That’s it. Once it is set up, your events start reaching Trackingplan. Then check that Trackingplan is collecting data correctly.

Questions or problems along the way? Contact support and we’ll get back to you as soon as possible.

GA4 Measurement Protocol

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 the webhook

If your backend sends its hits straight to Google, it also sends a copy of each request to your Trackingplan webhook.

  1. Open your install page, https://app.trackingplan.com/plans/YOUR_TP_ID/install, and go to the Webhook tab, under GA4 Measurement Protocol.
  2. Enter your GA4 measurement ID (G-…) in the field, then click Copy to copy your webhook URL. Trackingplan uses the measurement ID to show these hits under the GA4 destination of that property, together with what your website sends to it. If your backend sends hits to more than one GA4 property, get one URL per measurement ID, and send each copy to the URL of the measurement ID it was sent to.
  3. In your backend, find the code that sends each request to https://www.google-analytics.com/mp/collect.
  4. After that request, send a copy with the same JSON body to your webhook URL, as it is. Do not add Google's query string to it: your API secret stays out of the copy.
  5. Deploy the change.

Use this URL only for Measurement Protocol copies: the Segment and Amplitude URLs don't work for them, because each webhook URL tells Trackingplan how to read the data it receives.

For example, in Node.js:

const body = JSON.stringify(payload);
const options = { method: 'POST', headers: { 'Content-Type': 'application/json' }, body };

await fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${MEASUREMENT_ID}&api_secret=${API_SECRET}`, options);

// the copy for Trackingplan: never let it block or break the request to Google
fetch(TRACKINGPLAN_WEBHOOK_URL, 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 with their events and properties. Through the webhook, they appear under the GA4 destination of the measurement ID in your URL.

Questions or problems along the way? Contact support.

Server-side GTM

Before you start, we recommend talking to our support team. They'll help you set everything up correctly from the start and avoid problems later.

To install Trackingplan in server-side GTM, you’ll need to:

When the Modified tag sends a request, it messages the Trackingplan Tag with a copy of the request, which then forwards it to the Trackingplan Server.
When the Modified tag sends a request, it messages the Trackingplan Tag with a copy of the request, which then forwards it to the Trackingplan Server.

Prefer to watch? This video walks you through an installation from scratch:

How to Install the Trackingplan Tag

The Trackingplan tag captures GA4 requests and collects the messages from your modified tags, then sends it all to the Trackingplan server for monitoring.

You have two options: add it from the Community Template Gallery, or import it manually with the .tpl file. Then create a tag with it, as described below.

Add the template from the Community Template Gallery

  1. In your SSGTM container, go to Templates → Tag Templates → Search Gallery.
  2. Search for Trackingplan Server Side Tag and select it.
  3. Click Add to workspace, then confirm with Add.

Manual Installation

Import the template into your SSGTM container

  1. Download the template from https://github.com/trackingplan/trackingplan-ssgtm-tag/blob/main/template.tpl
  2. In your SSGTM container, go to Templates → New → Import from file
  3. Select the downloaded template file
  4. Save

Create a new tag using the template (whichever way you added it):

  1. In your SSGTM container, go to Tags → New
  2. Select the Trackingplan template
  3. Add your Trackingplan ID
  4. Expand Settings → Developer Settings. Set Trackingplan Endpoint to the tracksEndPoint from your install page.
  5. Set the trigger to All Events
  6. Click Save
  7. Publish your container

Using Stape? Install the tag the same way. On your website there is no domain to configure: Trackingplan detects your Stape container automatically. Add a custom domain with the stape parser ID only if your Stape Data Tag requests don't show up in Trackingplan.

How to modify the tags you want to monitor

Do this on every template you want Trackingplan to monitor.

  1. Open the tag template (this works on any tag)
  2. Add the Trackingplan Snippet to the top of the template (see code below)
  3. Remove/Comment the original sendHttpRequest and sendHttpGet methods.
  4. Enable the Send/Receive message permission
  5. Save
  6. Publish your changes

Trackingplan Snippet

/* Trackingplan snippet to be included in on top of templates to be monitored by Trackingplan */
const sendHttpRequest = (url, arg2, arg3, arg4) => {
    const isCallbackForm = typeof arg2 === 'function';
    const body = isCallbackForm ? arg4 : arg3;
    require('addEventCallback')(() => {
        require('sendMessage')('tp_request', { url: url, body: body });
    });
    return isCallbackForm
        ? require('sendHttpRequest')(url, arg2, arg3, arg4)
        : require('sendHttpRequest')(url, arg2, arg3);
};
const sendHttpGet = function (url, options) {
    require('addEventCallback')(() => {
        require('sendMessage')('tp_request', { url: url });
    });
    return require('sendHttpGet')(url, options);
};
/* End of Trackingplan snippet */

Using Custom domains

Many server-side tagging setups use first-party collection domains instead of the platforms' standard endpoints. GA4 hits to your container need no custom domain if they use the usual /g/collect path. Configure one only for the requests that don't show up in Trackingplan.

Trackingplan recognizes requests sent to the standard collection domains of the analytics and marketing platforms it supports, automatically. Those domains map to destination parsers, which understand each platform's request format and turn the raw requests into the enriched event format you see across Trackingplan.

If your implementation sends data to a custom collection domain instead of the platform's default one, Trackingplan can't identify it automatically. In that case, configure the custom domain when you install Trackingplan.

To configure a custom domain, you need:

  • The custom domain that your implementation sends requests to (for example, your own collection domain instead of the platform's default endpoint).
  • The parser ID that tells Trackingplan which platform those requests belong to (for example, googleanalytics for GA4 hits or tealium for a Tealium Collect endpoint).

The parser value is not the name you'll see in Trackingplan. It is the internal identifier that tells Trackingplan how to read requests from that domain.

For example, say your server-side GTM container receives GA4 hits at metrics.example.com/collect instead of the usual /g/collect path. Trackingplan can't tell what that path serves, so you tell it in the init options of the Trackingplan snippet on your website (see Advanced options):

customDomains: { "metrics.example.com/collect": "googleanalytics" }

From then on, Trackingplan treats every request to metrics.example.com/collect as a GA4 hit and parses it with the googleanalytics parser.

Some common parser IDs include:

Platform

Parser ID

Google Analytics 4

googleanalytics

Stape

stape

Tealium

tealium

Adobe Analytics

adobe

Adobe Target

adobe_target

Jentis

jentis

Piano

piano

These are only common examples. Not sure which parser ID fits your setup? Contact the Trackingplan team and we'll help you find it.

How to debug & verify everything is running properly

To check everything is running properly, look for the following in preview mode:

  1. Each time one of your modified tags sends a request (1 in the image), a Trackingplan request appears in its payload (2 in the image).
  2. For each Incoming Request (3 in the image), there is a matching Trackingplan request (4 in the image).

Was this useful? Write to support@trackingplan.com