The classic way to set up Google Tag Manager is through client-side tracking. The tracking then goes through your visitor’s browser or your user’s phone. The data is sent from there to your various tracking tools.
With server-side tracking, tracking is done on a separate server. The browser sends data directly to your own sGTM server and from there the data goes to the tracking tools you use.
This has the advantage that your cookies and tags are no longer blocked by the latest browsers or ad-blockers. It also provides a better user experience for your visitors because the tracking does not use your visitor’s resources. Loading times are also shorter as a result.
In this guide, we will explain how to set up server-side tagging in combination with an sGTM server with Combell.
Setting up server-side tagging in Google Tag Manager
- Go to Google Tag Manager and click “Create account” to create a new account. Or create a new container for server-side tagging within your existing account.
- Give your account a name and select the country in which you operate.
- Then enter your domain name under “Container name” and select “Server” as the platform.
- After that, click “Create” to continue.
- Accept the terms and conditions of Google Tag Manager and click “Yes”.Select “Manually provision tagging server”.
- After that, copy the Container Config. You need to provide that to us to set up your sGTM server.
Choose a subdomain for server-side tagging
After creating your server-side tagging container, you need to create a subdomain that will be linked to your tagging server.
Choose your own subdomain, e.g. sst.yourdomainname.be and provide it to our team.
Follow these steps to create a subdomain with Combell
Set DNS records for your subdomain
Your subdomain must be linked to your sGTM server. To do this, set up the following DNS records:
- A record for IPv4
sst.yourdomainname.be with IP address 37.72.160.38 (TTL 3600). - AAAA record for IPv6
sst.yourdomainname.be with IP address 2a00:1c98:10:90:370:7216:38:1 (TTL 3600).
Follow these steps to set up an A record and AAAA record with Combell
Set up your Google Tag Manager for server-side tagging
Now you still need to pre-set your tags, triggers and clients and make sure that that data arrives on your new sGTM server with us. For those instructions, please refer to the experts at Analytics Mania.
You’ve already gone through the first steps. You may start immediately at the subtitle “Configure tags, triggers, variables (if needed), clients in the server container.”
Update your Google Tag Manager Script
By default, Tag Manager or the Google tag (gtag.js) loads their dependencies from Google-owned servers, such as www.googletagmanager.com
. You need to update the script URL on your website to load dependencies through your own server.
To load the GTM code via your server container:
- Locate the existing Tag Manager code on the page.
- Replace the string
www.googletagmanager.com
with the domain name of your tagging server in the<head>
and<body>
of the Google Tag Manager installation code.
Head
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
Body
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=TAG_ID"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->