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

Setup GTM server container

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

GA4 configuration

Let's start with the GA4 configuration. Your AdPage server container is going to receive GA4-formatted requests sent from the client, so we'll set up a Google Analytics 4 client and tag to handle those incoming requests. These Google Tag Manager server container settings will ensure that the incoming GA4 requests get sent on to your Google Analytics 4 property as GA4 events.

1

GA4 Client

To begin with, let’s focus on the Client part of the Google Tag Manager server container. A Client on a Google Tag Manager server container is responsible for receiving incoming data on the server. The GA4 Client enables the server to receive and understand data in GA4 format.

By default, a GA4 Client should already exist on your server container. If you go to the Clients section, you should find this client. There are no changes needed to this Client for a regular server-side tagging setup.

Edit the GA4 Client

By default the GA4 client uses the JavaScript managed client ID, which means it reads the _ga cookie that the Google tag sets in the browser. That works fine for a standard server-side setup, so you can leave this section alone.

If you'd rather let the server handle identification, set Client ID source to Server Managed. The server container then writes its own first-party cookie called FPID in the HTTP response, with the HttpOnly flag, so browser JavaScript can't read it. Since it isn't set by JavaScript, it keeps its full lifespan, because Safari's ITP only shortens cookies that JavaScript sets. That's the main reason to switch. Returning visitors stay recognisable for longer, and your user and attribution data holds up better.

If you make this change on a property that already gets traffic, also check Migrate from JavaScript Managed Client ID. Visitors who already have a _ga cookie will keep their current ID, and FPID only takes over once that cookie is gone. Without it, all your existing visitors get a new ID at the same time, which shows up in GA4 as a spike in new users. On a brand new property there's nothing to migrate, so you don't need the option.

Two things worth checking before you switch. First, the client ID that GA4 receives comes from the FPID value, so it no longer matches the _ga value that client-side scripts can read. If other tools or integrations rely on that value, test them first. Second, with Server Managed turned on, the FPID cookie gets generated on every request the client claims, no matter what the consent state is, unless you blank out the cookie name conditionally.

2

GA4 Tag configuration

Now that the GA4 client is configured, the server can receive and process GA4 web tracking requests. Now we need to a create a Tag to dispatch these requests to the correct GA4 property.

Go to the Tags tab of your server container and create a new tag.

Select Google Analytics: GA4 as the tag configuration.

In this GA4 tag, several configurations are possible. Here are the 2 most commonly used fields:

Measurement ID This measurement ID decides which GA4 property your data goes to. If you fill it in, everything gets sent to that property. If you leave it empty, it uses whichever measurement ID your web container sends along.

Event name This field lets you force the tag to send one specific event name to GA4. Leave it empty and the event names coming in from your web container get passed along as they are.

3

GA4 trigger configuration

To forward all GA4 events arriving on your server to your GA4 property, configure the tag to trigger when the Client Name equals GA4.

If Client Name doesn’t appear in the dropdown for the trigger condition, enable it by clicking on Choose Built-in variable.

Preview url configuration

To be able to use the preview mode in your Google Tag Manager server container, you have to input the server which tracking subdomain you're using. Without this step you won't be able to launch the preview on the server side.

Go to the Admin section of your Google Tag Manager server container and open Container settings. On that page, add the tracking subdomain you set up earlier in the Server container URLs input field.

What's next?

You've just set up your first server-side tagging setup for Google Analytics 4. With your GA4 Client and Tag configured, head on to the next step, where you'll set up the Google Tag Manager web container so it can send GA4 requests to your server container based on website-interactions.

Last updated

Was this helpful?