Collecting data about your website visitors is critical for analyzing and improving the online business presence, reaching users, and converting them into customers.
However, collecting data is becoming more problematic because of Intelligent Tracking Prevention, AdBlockers, and a decrease in cookie lifetime. Google Analytics and other similar tools will start seeing fewer data about your website visitors and giving you less information to analyze. On the other side, tracking policies and rules make website owners strictly control what data about website visitors they share with 3rd party tools.
To help address these challenges, Google introduces a new feature – Server-Side Tagging to Google Tag Manager.
Google Tag Manager (GTM) Server-Side tagging allows website owners to move third-party tracking pixels from their website and start tracking website visitors from the server. It means that the client browser will no longer process tracking pixels. It will be loaded directly from the server.
This approach provides the following benefits:
If server-side tracking is hosted in your website’s subdomain, all requests will be considered first-party. Google has a detailed description of what is GTM server tracking and how it can benefit your website.
There are many common elements between web and server containers, like tags, triggers, variables, preview mode, etc. The setup of the GTM server-side container is more complex than the standard web container. You will need knowledge of web GTM, Google Analytics, Google Cloud, and web programming in general. I suggest reading this blog post if you wish to set up a GTM server container via a native Google environment.
We created a service that simplifies GTM server container configuration by removing the part of Google Cloud servers set up, streamlining domain creation, giving you the ability to download Google Analytics from your domain, and making 3rd party cookies 1st party.
1. First of all, you need to create a Google Tag Manager Server container. To do that, go to https://tagmanager.google.com/ and choose the account where you want to make a container. Click Admin.
2. Under the container column, click +.
3. Type container name, choose Server, and click create.
4. Choose “Manually provision tagging server”, copy your container config and paste it in any text editor. We will need it for the next steps.
5. Create or login to your account in our service.
6. Once you received the email with the link and set your password, you need to click "Create Container". Add your container name, Container Configuration that you copied from your Google Tag Manager Server Container, and select server location. Click Create Container.
7. Once you click create, you will see the status of your container, container config, and plan name. It takes around 5 minutes to deploy a server container. Please reload the page to update the status. If the setup was done correctly, you should see the status “Running”.
If you see “Error” please check that you’ve copied and pasted the correct container configuration.
If the error repeats contact the support.
8. In this step, you need to set up a tagging URL.
You have two options:
If you choose to go with the first option, move to step 9.
If you want to configure a custom tagging URL, enable "Use custom domain" -> log in to your domain name service and create a new DNS record for the subdomain you want to use. You can use any subdomain name you want. (if you are using Cloudflare, select domain -> click DNS -> Add record).
Add these settings:
Name: ss (or any other subdomain name you want)
IPv4 address: IP address depends on the location of the servers. You can find the custom domain IP address in your stape.io account.
Proxy status: disable
Your settings should look like this:
Once you’ve done add subdomain inside gtm server account.
9. You might want to enable Global CDN for the sGTM container. Global CDN feature is free for all stape container. It uses Cloudflare technology to load js files (gtm.js, gtag.js, analytics.js, etc.) from a server that is closer proximity to your site visitors, resulting in a faster js file serving. It leads to a better page speed and, in the end, has a positive effect on SEO optimization.
Consider your country's privacy regulations before enabling Global CDN.
After you've enabled Global CDN you will need to add CNAME record to make Global CDN work.
10. This step depends on the tagging server URL you are using.
You have two options here:
11. Add tagging server URL to the Google Tag Manager Server container. Admin -> settings -> container settings.
12. Update Universal Analytics tagging URL inside WEB GTM container (if you are using GA4 go to the next step). Edit Universal Analytics Base or Universal Analytics Variable inside WEB container -> Click More Settings -> Advanced configuration -> paste tagging URL inside the field “transport URL”. Once done click save and publish web container.
13. If you are using GA4 follow these steps: Inside the WEB container click edit or create GA4 tag -> enable Send to server container -> add Server Container URL
Save the tag (this tag should trigger on all pages) and publish container.
14. Create Universal Analytics or Google Analytics 4 client inside the Google Tag Manager Server container. Click Clients -> New -> Choose Client type -> Add client name -> Click save.
15. Set up Universal Analytics or GA4 tag inside the Server Container. Go to “Tags” section inside Server Container and Click “New.”
Name Your Tag, choose tag type “Universal Analytics” or “GA4”. In case you don’t see these tags go to Clients tab and check that UA and GA4 clients were added, if not add these clients.
Create a trigger. Trigger type “Custom,” choose “Some Events.” Client Name equals Universal Analytics.
16. Open the debug mode inside your Server Container. Open your website and click on several pages. Go back to the debug tab, you should see Universal Analytics and GA4 requests.
17. Another way to test Universal Analytics and GA4 requests are working via server is to use developers tool. Open your site -> Click alt+command+i (on Mac) or right mouse click and inspect -> go to network tab -> reload the page -> type collect -> click on the request and check that request URL matches your tagging URL. You can do it for both UA and GA4.
That’s it. Now you’ve set up a server container, and Google Analytics runs via your server container. If you want to load GA within your domain and make GA request 1st party follow these steps to use a custom subdomain. And our team of experts can help!
Please, answer a few simple questions. Click Get A Quote, fill up the form, and we will send you a quote.
What cost can you expect for server Google Tag Manager hosted on Google Cloud? Is it a good idea to use a test environment on the productions site. Why stape’s hosting for server GTM is cheaper and how we secure our user’s data.Sep 16, 2021
Find out how to use server-side tracking with Google Tag Manager and avoid being blocked by AdBlocker.