How to send events to GTM server container with Google Tags Preset?

This preset should be imported into a GTM Web container, but it is pointing to a GTM Server container. The GTM Server container URL is a prerequisite to complete this guide.

Read this document on how to provision GTM Server container hosting.


IMPORTANT: only install and publish this preset after your GTM Server container configuration is done and published too. Otherwise your web container will be sending data to a server container that is not yet ready to process it.


The "Google Tag to Server (Advanced)" presets allows to forward traffic from GTM web container to GTM server container to enable server-side tagging features.

When combined with the "GTM Web Container Server-Side" preset, it makes all traffic from the browser go to the GTM Server container instead of 3rd party APIs such as Google Analytics. This may prevent some of the privacy features of the browser from blocking those requests. It also allows the use of server-created 1st party cookies, which are the most reliable way of keeping data between users' sessions.

Also, it means there will be just one HTTP call per tracked event no matter how many 3rd party destinations are integrated in the GTM Server container.


1. Download & Import the preset

Open WP Admin and navigate to Settings and Google Tag Manager. Then select GTM Presets tab which contains presets for classic web containers:

The import the file in your GTM Web Container according to this guide.

2. Set variables

Once you have imported the prest into a GTM Web Container you need to set values of two variables:

  • GA4 to Server Measurement ID
  • Server Container URL

Head to GTM Workspace and click Variables on the left, then find those variables:

Then fill in the values:

  • GA4 To Server Measurement ID - should be the measurement ID of the GA4 instance that will be connected in the GTM server container. In case of migrations it can still be the same value as the main GA4 Measurement ID
  • Server Container URL - this is a hostname, in most cases a subdomain url that was configured for the GTM Server Container (when provisioning the Server Container hosting as described in this guide)

3. (Optionally) Pause existing web tags

If you are adding this preset to an existing GTM Web Container that already has tags running you need to pause or remove them. This needs to happen for all services that will be connected via GTM Serve Container. If you will connect to all desired tools and services only from GTM Server Container your GTM Web Container can only have tags from the single Google Tag to Server (Advanced) preset.

In order to do pause the tags, navigate to Tags view in your GTM Web Container, find affected tags and select all of them. The click "pause" icon above the table to pause them.

Not pausing those tags will duplicate the traffic sent to given destination tool. It will be sent directly from the browser and then via server container again. Although there may be use-cases when handling same event in both GTM containers may make sense, this is more advanced scenario that can easily lead to corrupted tracking and is not recommended.

4. Preview and publish

Once variables are configured and optionally all relevant tags are paused or removed you can run GTM preview to ensure correct operations and publish the new version of the container whenever ready.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.