Configure your server container
GA4 configuration
We're going to configure GA4 on the server side so that the server can receive requests in GA4 format and dispatch them to the Google Analytics servers.
GA4 client configuration
To begin with, let's focus on the client part of sGTM. A client on sGTM is responsible for receiving incoming data on the server. The GA4 client enables the server to receive and understand data in GA4 format. Once the client receives this data, the tags will dispatch it to the marketing platforms.
By default, a GA4 client already exists on the server. If you go to the Clients section of sGTM, you should find this client.
We'll simply edit this client to maintain the continuity of GA4 client IDs. This GA4 client will create a new Client ID cookie for GA4 called FPID
. By checking the Migrate from JavaScript Managed Client ID box, the cookie will be created based on the GA4 cookie generated on the client side.
Check this box and save changes.
GA4 tag configuration
Now that the GA4 client is configured, the server can receive GA4 web tracking requests. Now we need to create tags to dispatch these requests to the right marketing platforms.
Go to the Tags tab of your server container and create a new tag.
Select Google Analytics: GA4 tag under Google Analytics section.
In this GA4 tag, several configurations are possible. Here are the 4 most commonly used fields:
Measurement ID
This measurement ID is used to send data to the correct GA4 property. If this field is filled in, all data will be sent to this property. Otherwise, the measurement ID used will be the one sent by your web container.
Google signals
Google signals are session data from websites and applications that Google associates with users who are logged in to their Google account and have enabled ad personalization. This data enables cross-device remarketing and the export of cross-device conversions to Google Ads.
Google signals can only be enabled if a measurement ID is defined on the server side.
Hide IP address
This field allows you to remove the IP address before transmitting data to GA4, thus preventing access to visitors' geographical data.
Event name
This field is used to force the tag to send a specific event name to GA4. If left empty, event names received from the web container will be forwarded to GA4.
Unless otherwise stated, this field should be left blank.
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
is GA4
.
Create a new trigger by clicking in the trigger section of the tag.
Select the custom trigger type.
In this trigger, set a single rule: Client Name
equals GA4
. This rule means that this tag will be triggered by every incoming GA4 request to the server.
If Client Name doesn't appear in the dropdown, enable it by clicking on Choose Built-in variable.
Save the trigger and tag.
Preview url configuration
We now need to specify to the server which tracking subdomain will be used. This step is essential to be able to launch the preview on GTM server-side.
To do this, go to the Admin section of sGTM, then to Container settings.
On this page, add the tracking sub-domain previously declared in Addingwell, in the Server container URLs section.
Save this modification.
Next step
Now that you've configured your GA4 tag, go on to the next step to configure Tag Health so that you can monitor what's happening on your live server.