In this article, I am going to talk about how to send data from website to server side container.
Note: This article is the third part of the server-side tagging article. If you haven’t read the earlier ones, I would highly recommend going through them. You can find them here:
Note: You can send data to a server-side container in the following ways:
Using GTM: You can use regular GTM on the client-side to send data
Using gtag.js: You can also use gtag.js to send data to server-side container
Custom code: You can also write custom code as well
In our case, I am using the regular version of the client-side GTM container.
Now follow the below steps to start configuring the client-side GTM container.
Step-1: Log in to your client-side GTM container and click on the ‘Variables’ tab.
Step-2: Select the ‘Google Analytics Setting’ variable. This is the variable that sends data directly to the Google Analytics server. We will be configuring it to send data to our server-side container, and not directly to the Google Analytics server.
Step-3: A new overlay will appear. Click on the pencil icon to edit the variable settings.
Step-4: Click on ‘More Settings’ and then click on ‘Advanced Configuration’.
Step-5: In the ‘Transport URL’ input box, you need to provide the tagging server URL so that instead of directly sending the data to Google Analytics, it will send data to our server-side container.
You can find the tagging server URL in the ‘Admin’ section of the server-side GTM container. Copy this URL.
Step-6: Paste the tagging server URL in ‘Transport URL’ input box and click on ‘Save’.
Step-7: Now create a normal Universal Analytics page view tag that will fire on all pages.
Congratulations! You have successfully configured your client-side container to send data to the server-side container. Now let’s configure the server-side container to send data to Google Analytics.
Configuration of server-side GTM container
Follow the below steps, to begin with:
Step-1: Navigate to your server-side container and click on ‘Tags’ and click on ‘New’.
Step-2: Give your tag a descriptive name and click on ‘Tag configuration’.
Step-3: An overlay will appear on the right-hand side with a list of tag templates.
Since server-side tagging is currently still in beta version, there are only three types of tag template. ‘Google Analytics: GA4’, ‘Google Analytics: Universal Analytics’ and ‘HTTP request’.
In our case, we will select ‘Google Analytics: Universal Analytics’.
Step-4: In the ‘Tag configuration’ window, you have the option to select the check box ‘Enable overriding settings in this tag’. We will keep it unchecked because, by default, the server-side container inherits the analytics ID from the client-side container. You also get the option for ‘Advanced settings’ which is similar to the typical GA tag settings.
Step-5: Click on ‘Triggering’ to create a trigger for our tag.
Step-6: Click on the ‘+’ icon to create a new trigger. Give a descriptive name to your trigger. Note that like a typical GTM container you don’t get the predefined trigger of ‘All Pages’ here. There is only one trigger type available at the moment which is ‘Custom Trigger’.
Step-7: Click on ‘Trigger Type’ and you can specify the trigger condition here by selecting the ‘Some Events’ option. You can also create a new variable to define your trigger condition or choose the built-in variables as well.
Step-8: In our case, we want to pass data to Google Analytics hence we will select the condition as ‘Client name’ equals ‘Universal Analytics’.
Step-9: Click on ‘Save’.
Just to give you more idea about clients, you will have noticed that in the server-side container there is one extra menu called ‘Clients’. Here you will find all the third-party tools to which you would like to send the data. Currently, there are only two clients available by default, which are ‘Universal Analytics’ and ‘App + Web’. Hopefully, Google will come with various clients (Facebook, Google Ads, etc) here in near future.
As a next step, we will preview and validate if the server-side container receives data from the client-side container and how it sends it to Google Analytics.
Step-1: Navigate to the client-side GTM container and then click on ‘Preview’.
Step-2: Enter your website URL and click on ‘Connect’.
Step-3: Navigate back to the preview window. You can see that the Google Analytics pageview tag has fired. Click on the tag to know more.
Note that even though the GA pageview tag has fired you will not see any data in Google Analytics in real-time. This is because this tag is sending data to server-side containers and not to Google Analytics directly. Since we are yet to preview and debug the server-side container you won’t be able to see it in real-time reports.
As you can see from the below image, the ‘page view’ hit is being transported to https://gtm.optimizesmart.com which is the server URL of the GTM container on the server-side.
Step-4: Now navigate to server-side GTM container and click on ‘Preview’.
Step-5: A new window will open like below with a blank summary.
Step-6: Go to your website and visit any page with the client-side GTM container code available on it. Switch back to the preview window and you can see the pageview hit received from the client-side container, and, for the same hit, the Google Universal Analytics tag has fired.
As you can see from the below image, a page view request is generated and multiple scroll events are also generated (since I have implemented scroll tracking in the client-side container).
If you click on the ‘Request’ tab on the preview window you can check the Universal Analytics tag.
You will also notice the incoming HTTP request and outgoing HTTP request to the Google Analytics server.
To see the details of the tag fired you can click on the ‘Tags’ tab of the preview window and select ‘Universal Analytics’.
It will provide you with the tag details, outgoing HTTP request details, and the trigger condition of the server-side container.
The ‘Variables’ tab in the preview window will provide the list of variables enabled and their corresponding values.
The ‘Event Data’ tab will provide you with all the information which is collected and being passed to the endpoint tool, like Google Analytics in this case.
Validation in real-time
Now navigate to your Google Analytics account and click on ‘Real-time’, and then on ‘Overview’. You should be seeing the page view request below.
So that is how you send data from a website to a server-side container, and then finally to Google Analytics.
Frequently asked questions about how to send data from a website to a server-side container.
What is server-side tagging in GTM?
Server-side tagging is a new way to use Google Tag Manager (aka GTM) in Google’s cloud environment. It has benefits like reduced page load time, better security, and control over the data that you send to Google Analytics and third-party tools. Where a normal Google Tag Manager container resided in a client-side environment, a server-side container resides in the Google Cloud environment. Server-side containers also use the same concepts, like tags, triggers, and variables, which you have used earlier.
How does server-side tracking work?
A server-side container acts like a proxy in the cloud environment that you own. So instead of sending hits directly to the endpoint server (like in client-side GTM), you send hits to a server-side GTM container and then to the endpoint server which collects the data. As you can see from the above image, the server-side container runs in the Google cloud platform owned by the customer and only the customer has access to the data which is being sent to third-party tools. You have complete control over the data on how it’s being routed to the third-party tool.
What are clients in server-side GTM containers?
In Google’s words, clients are adapters between the software running on a user’s device and your server container. The main objective of clients is to receive data from the user’s device, process and transform the data and then send it to the endpoint tool like Google Analytics.
Get weekly practical tips on GA4 and/or BigQuery to accurately track and read your analytics data.
My best selling books on Digital Analytics and Conversion Optimization
Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.
Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.
Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.
Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.
About the Author
Himanshu Sharma
Founder, OptimizeSmart.com
Over 15 years of experience in digital analytics and marketing
Author of four best-selling books on digital analytics and conversion optimization
Nominated for Digital Analytics Association Awards for Excellence
Runs one of the most popular blogs in the world on digital analytics
Consultant to countless small and big businesses over the decade
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.