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 create a container. Enter your container name and paste the container config that you copied from your Google Tag Manager Server Container. 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, click Add 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.
We have these servers locations:
Proxy status: disable
Your settings should look like this:
Once you’ve done add subdomain inside gtm server account.
9. The next step depends on the tagging server URL you are using.
You have to options here:
10. Add tagging server URL to the Google Tag Manager Server container. Admin -> settings -> container settings.
11. 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 -> past tagging URL inside the field “transport URL”. Once done click save and publish web container.
12. 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.
13. 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.
14. 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.
15. 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.
16. 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.