How to send data from Website to Server Side Container

Table of contents for how to send data from website to server side container 

  1. Configuration of client-side GTM container
  2. Configuration of server-side GTM container
  3. Preview and debug
  4. Validation in real-time
  5. FAQ

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:

  1. How to Create Server-Side Container for Google Tag Manager
  2. How to Configure DNS for GTM Server Side Container

We have already created our server-side GTM container and configured DNS so now we will proceed with configuring the client-side GTM container.

gtm 101 
Get the E-Book (100 Pages)
gtm data layers
Get the E-Book (62 Pages)

Configuration of client-side GTM container

Note: You can send data to a server-side container in the following ways:

  1. Using GTM: You can use regular GTM on the client-side to send data
  2. Using gtag.js: You can also use gtag.js to send data to server-side container
  3. 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.

Variable in Client side container

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.

select GA Variable in Client side container

Step-3: A new overlay will appear. Click on the pencil icon to edit the variable settings.

Pencil icon Variable in Client side container

Step-4: Click on ‘More Settings’ and then click on ‘Advanced Configuration’.

more settings in client side ga variable

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.

tagging server URL 1

Step-6: Paste the tagging server URL in ‘Transport URL’ input box and click on ‘Save’.

transport URL

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’.

new tag server side

Step-2: Give your tag a descriptive name and click on ‘Tag configuration’.

tag configuration 1

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’.

tag template

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.

tag configuration 1 1

Step-5: Click on ‘Triggering’ to create a trigger for our tag.

trigger

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’.

trigger type 1

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.

custom trigger configuration

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’.

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.

clients

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.

Preview and debug

Follow the below steps to preview and debug.

Step-1: Navigate to the client-side GTM container and then click on ‘Preview’.

preivew client side

Step-2: Enter your website URL and click on ‘Connect’.

connect to website

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.

How to send data from Website to Server Side Container

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.

tag details

Step-4: Now navigate to server-side GTM container and click on ‘Preview’.

server preview

Step-5: A new window will open like below with a blank summary.

blank window

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.

page view tag 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).

server preview 1

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.

incoming and outgoing request

To see the details of the tag fired you can click on the ‘Tags’ tab of the preview window and select ‘Universal Analytics’.

tags tab

It will provide you with the tag details, outgoing HTTP request details, and the trigger condition of the server-side container.

tag request details

The ‘Variables’ tab in the preview window will provide the list of variables enabled and their corresponding values.

variable tab

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.

event data tab

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.

realtime view

So that is how you send data from a website to a server-side container, and then finally to Google Analytics.

Related Articles

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.
wA5PvG6 WDJ9jQ EVH8eTqDUuhjFqroISiwpkaP3KwlIY7j9vJkE6fue14zvgF Sp3PjaTS qKgIhMkOaaHTO06I L1fc zXul7kgE5 vZPPgDyOyozyZL2XKO8up2L8cQW 8hij
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.  

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

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
error: Alert: Content is protected !!