For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setup GTM web container

Go from sign-up to your first deploy in under five minutes.

GA4 configuration

In your Google Tag Manager web container, you'll set up GA4 event tags based on site-interactions. These tags turn those interactions into events and send them to your server container URL. Once GA4 tracking is set up properly on the client side, sending those events out to the different platforms from the server becomes pretty simple.

1

Overwrite the GA4 endpoint in the Google Tag

If you use server-side tagging, your GA4 hits should be sent to your own tracking domain instead of directly to Google. The easiest way to do this is in one place: the Google Tag.

The Google tag (gtag.js outside of Google Tag Manager) is not a tag that measures something by itself. It loads the Google measurement library and sets up the shared configuration that all your GA4 hits use.

A GA4 Event tag contains almost nothing on its own. It adds the event name and its event parameters, and inherits everything else from the Google tag that carries the same Measurement ID. That is exactly why the endpoint override belongs on the Google tag: set it once, and every event tag follows.

Open the Google Tag in the Google Tag Manager web container used for the GA4 configuration. Ensure that the following three parameters are added:

  • server_container_url = your AdPage server container URL

  • send_page_view = false

  • first_party_collection = true

2

GA4 page_view event tag

Because we've just set the 'send_page_view' configuration parameter to false in the Google Tag, we will need a separate GA4 event tag.

You set the send_page_view parameter to false in the Google tag. The reason is that the page_view event would otherwise be created automatically the moment the Google tag fires. If that happens, you cannot add any extra parameters to that page_view event. The event_id parameter in particular matters a great deal, because the tracking setup of marketing platforms relies on it for deduplication.

Go to Tags and create new tag. Select Google Analytics: GA4 Event as the tag configuration. In the Measurement ID input field you fill in your GA4 property's Measurement ID, and in the Event Name field you fill in 'page_view'.

Give this tag the correct Trigger. If you are using a Consent Management Platform with a dataLayer event push on every page, you set up the trigger based on that dataLayer event. Otherwise choose the All Pages trigger.

Every other GA4 event tag in your web container that uses the same Measurement ID picks up its configuration from the Google tag. From this point on, all of them get sent to your server_container_url instead of straight to Google Analytics. That includes purchases, form submissions, custom events, and everything else you built earlier. This is exactly what's supposed to happen, but it does mean your whole GA4 measurement now runs through the server container.

So test it before you publish. Open preview mode in your web container, click through the pages and interactions that fire your GA4 event tags, and check that each request goes to your tracking domain. Keep the preview of your server container open next to it so you can confirm the events show up there, get claimed by the GA4 Client, and go out to GA4 with the parameters you expect. Don't publish until you've seen every important event make it through from start to finish.

What's next?

You’ve finished configuring the Google Tag Manager web container to send GA4 event requests towards your server container. Before you start testing the configuration so far and setting up your marketing platform tracking, let's first set up the Data Assistent Tag for events monitoring so that you can monitor what’s happening on the website's dataLayer.

Last updated

Was this helpful?