Get started
This guide goes over the steps needed to get a server-side tagging container up and running, how it integrates with your Usercentrics CMP and how to get data flowing into server-side tags and 3rd party systems.
Create a server container¶
The server container needs to be created in two places: Google Tag Manager and Usercentrics Server-Side Tagging. They will be connected together and work in tandem: while Usercentrics provides the hosting infrastructure and other functionality, Google Tag Manager is used to set up your implementation (using clients, tags, transformations, etc.)
Create the container in Google Tag Manager¶
-
Go to Google Tag Manager, and sign in or create an account if you don’t already have one
-
Click on Create Container and under type, select Server.
-
Google Tag Manager will ask how you wish to provision this server. Select Manually provision tagging server and then copy the Container Configuration string.
Create the container in Usercentrics Server-Side Tagging¶
-
Go to Usercentrics Server-Side Tagging, and sign in or create an account if you don’t already have one
-
If this is a new account, input your company’s information
-
Click Create Container, give it a name and paste the Container Configuration string that was copied from Google Tag Manager
-
Click on the Create Container button to provision your new server-side tagging container. You will be taken to the container details page. You will see the container status go from Provisioning to Active.
At this point, the container is ready to be used. However, to truly reap the benefits of server-side tagging we need to make it available under a custom domain. We’ll cover how to do that in the next section.
Add a custom domain¶
One of the main benefits from running a server-side container is that it can be hosted under a first-party context. That is, by making it accessible under a subdomain of the website(s) it is associated with, measurement cookies can be set from the server and will be first-party. This means they’ll be more secure and durable (i.e. have longer lifespans), increasing the attribution window for conversion events — this is key to improve the data quality reaching marketing channels.
Depending on your subscription plan, you may add one or multiple custom domains to your container. This needs two things: defining the domain(s) you want to use in the Usercentrics Server-Side Tagging platform, and configuring their DNS records appropriately.
To add a custom domain, follow these steps:
-
Under the container’s details screen, go to the Domains section and input the subdomain you would like to use and click Add domain. So, if your brand’s website is accessible at
example.com
, then you could use something likesst.example.com
ordata.example.com
. -
After adding your domain for the container, you should now go to your DNS provider and create a CNAME record with the corresponding host and value displayed for your entry.
Here are some documentation references on how to create DNS records for common providers: Wix, Cloudflare, WordPress.com, Namecheap, GoDaddy. If your vendor is not listed, search their support pages for “How to setup a CNAME Record”.
-
When you’ve added your DNS settings, the domain will change from Pending to Active status (and turn green). This might take from a few minutes up to 72 hours, depending on your provider. You will be notified when the domain has been verified.
-
At this point, your container will be accessible under your custom domain. Quickly test that it’s working by going to your browser and input the domain followed by the
/healthz
path. You should see anok
response. This URL is a health-check endpoint that you can use anytime to check if your container is operational. -
To complete your custom domain setup, you should also add it to your container’s settings, so that’s it accessible for debugging when using Preview mode. In Google Tag Manager, select Admin, then Container Settings, then click on Add URL once, add the custom URL, and click Save.
Set up the data flow¶
Overview¶
Now that we have a fully deployed server Google Tag Manager container, it’s time to start using it. There are two things we need to do:
-
Setup the client to send data to the server container: we need to change our website’s tag configurations to point to our new domain, instead of sending data directly to 3rd party services.
-
Use consent signals in the server container: we need to make the service-level consent signals available to the server, so they can be used in trigger conditions for tags and transformations.
Looking at the diagram for server-side tagging, you may notice that there’s a single connection going from the client to the server, through Google Analytics 4 (GA4). That is because the cleanest and easiest to maintain setup is to consolidate data flow under a single stream, and then trigger tags for different services on the server container.
Setup the client to send data to the server container¶
Your website may run client-side tags in one of two ways: through a tag manager (like web GTM) or by including scripts directly on the page. Given how widely used it is by marketers and how well it pairs with server GTM, we will describe the required configuration for a website using web GTM.
Configure web GTM with GA4 as the client-to-server data stream¶
-
(Optional) If you don’t already one, you should create a web container in Google Tag Manager. It’s very similar to the process described above, but you should select the Web container type. Make sure to deploy it to your page following the instructions displayed in GTM.
-
(Optional) We will use GA4 as the data stream, which needs the Google tag deployed to the website. If you don’t already have it, add the Google Tag to your web container, set your Measurement ID, and set the Firing Trigger to Initialization - All Pages
-
The way the Google tag knows to communicate with your server-side container is through the
server_container_url
configuration variable. Under the tag’s Configuration Settings section, click on Add parameter and then inputserver_container_url
as the name, and your container domain in the value field (e.g.https://demo.example.com
) -
Save your changes to the Google tag and go into preview mode in both your web and server containers. When your page loads in the web container’s preview screen, you should see events going to your server container.
-
If you see requests coming into the server container, it means your Google tag is correctly setup and you can publish your web container changes.
If you’re already using the Google Analytics 4 tag, it should automatically send its data through your server container as well. If you’re not using it yet, you will want to add it, to track other events and data attributes.
With this, the basic setup to get data flowing from the website to the server container is complete.
Next step is making sure to use consent signals in your server-side container. A recommended (optional) step is to have your container serve your Google scripts (gtm.js
and gtag.js
), which you can read about below.
Serve scripts from your container (optional, recommended)¶
We recommend serving Google scripts from your server container instead of their default source (googletagmanager.com
). This gives you full control over user’s data that reaches 3rd party services, and makes your setup more resilient to device restrictions.
To enable serving the Google Tag Manager script (gtm.js
) and dependent ones like the Google tag Google tag (gtag.js
) from your domain, you need to:
-
Add the Google Tag Manager Web Container client to your server container, select the web container IDs you enable, click Save and then Submit to publish your container changes.
-
Change your website’s script that loads Google Tag Manager to point to your server container URL. So, substitute
www.googletagmanager.com
with your custom container domain (likedemo.example.com
).
Move on to the next section: use consent signals in your server-side container.