--- title: "Get started with server-side tagging" slug: "get-started-with-sgtm" description: "Set up server-side tagging with Usercentrics and Google Tag Manager to enhance data accuracy and security for your marketing efforts." tags: ["Server-Side Tracking", "SST", "Google Tag Manager"] updated: 2026-09-30T10:38:54Z published: 2026-09-30T10:38:54Z canonical: "usercentrics.com/get-started-with-sgtm" --- > ## Documentation Index > Fetch the complete documentation index at: https://usercentrics.com/docs/llms.txt > Use this file to discover all available pages before exploring further. # Get started with server-side tagging This guide walks you through the steps needed to get a server-side tagging container up and running, integrate it with your Usercentrics CMP, and get data flowing into server-side tags and third-party systems. Watch our **quick overview video below** or **follow the steps in this page to get started**. ### We need your consent to load the YouTube Video service! We use a third party service to embed video content that may collect data about your activity. Please review the details and accept the service to watch this video. powered by [Usercentrics Consent Management Platform](https://usercentrics.com/consent-management-platform-powered-by-usercentrics/) [YouTube video player](https://www.youtube-nocookie.com/embed/2uHgkvatdsg?si=sdcoHfgNT6eayX_i) ## Create a server container The server container needs to be created in two places: Google Tag Manager and Usercentrics Server-Side Tracking. They will be connected to each other and work in tandem: while Usercentrics provides the hosting infrastructure and other functionality, Google Tag Manager is used to set up your implementation (e.g. using clients, tags, transformations). ### **Create the container in Google Tag Manager**[**¶**](https://usercentrics.com/docs/sst/get-started/#create-the-container-in-google-tag-manager) 1. Go to **Google Tag Manager**, and sign in or create an account if you don’t already have one. 2. Click on **Create Container** and under **Target platform**, select **Server**. ![Create server container](https://cdn.document360.io/17f91ed2-e9be-4746-9f2b-1fa43f97e9b5/Images/Documentation/image-1763638277987.png?sv=2026-02-06&spr=https&st=2026-11-19T08%3A01%3A43Z&se=2026-11-19T09%3A01%3A43Z&sr=b&sp=r&sig=ufA%2BZfdWvGX%2Br8PiteuFvukW11dJ%2Fw3XlGu2OcLHp9Y%3D) 3. Google Tag Manager will ask how you want to provision this server. Select **Manually provision tagging server** and then copy the container configuration string. ![Manually provision tagging server](https://usercentrics.com/docs/assets/sst/screens/2-manually-provision.png) ### **Create the container in Usercentrics Server-Side Tracking**[**¶**](https://usercentrics.com/docs/sst/get-started/#create-the-container-in-usercentrics-server-side-tagging) 1. Go to [**Usercentrics Server-Side Tracking**](https://sst.usercentrics.eu/?ref=docs), and sign in or create an account if you don’t already have one. 2. If this is a new account, add your company’s information. 3. Click **Create Container**, give it a name and **paste the Container Configuration** **string** that was copied from Google Tag Manager. ![Create a container in Usercentrics](https://usercentrics.com/docs/assets/sst/screens/3-uc-create-container.png) 4. Click 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**. ![Container details](https://usercentrics.com/docs/assets/sst/screens/4-uc-container-details.png) 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**[**¶**](https://usercentrics.com/docs/sst/get-started/#add-a-custom-domain) A key advantage of using a server-side container is that it can run in a **first-party context**. In practice, this means hosting it on a subdomain of your website(s). When set up this way, cookies placed by the server are considered **first-party cookies**, which makes them more secure and longer-lasting. As a result, your conversion tracking window is extended, and the data sent to your marketing platforms is more accurate and reliable. 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 Tracking platform, and configuring their DNS records appropriately. To **add a custom domain**, follow these steps: 1. Under the container’s details screen, go to the **Domains** section, **enter the subdomain you would like to use** and click **Add domain**. For example, if your brand’s website is accessible at `example.com`, then you could use something like `sst.example.com` or `data.example.com`. ![Add domain](https://usercentrics.com/docs/assets/sst/screens/5-add-domain.png) 2. After adding your domain for the container, go to your DNS provider and create a CNAME record with the corresponding **host** and **value** displayed for your entry. ![Domain pending status](https://usercentrics.com/docs/assets/sst/screens/6-domain-pending.png)Here are some documentation references on how to create DNS records for common providers: [Wix](https://support.wix.com/en/article/managing-dns-records-in-your-wix-account), [Cloudflare](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/), [WordPress.com](https://wordpress.com/support/domains/custom-dns/), [Namecheap](https://www.namecheap.com/support/knowledgebase/article.aspx/9646/2237/how-to-create-a-cname-record-for-your-domain/), [GoDaddy](https://www.godaddy.com/help/add-a-cname-record-19236). If your vendor is not listed, search their support pages for “How to set up a CNAME record”. 3. 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. ![Domain activated status](https://usercentrics.com/docs/assets/sst/screens/7-domain-active.png) 4. At this point, your container is accessible under your custom domain. Test that it’s working by going to your browser and input the domain followed by the `/healthz` path. You should see an `ok` response. This URL is a health-check endpoint that you can use any time to check if your container is operational. ![Test active](https://usercentrics.com/docs/assets/sst/screens/8-test-access.png) 5. To complete your custom domain setup, 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**. Click on **Add URL** once, **add the custom URL**, and click **Save**. ![Add preview domain](https://usercentrics.com/docs/assets/sst/screens/9-add-preview-domain.png) ## **Set up the data flow** ### **Overview**[**¶**](https://usercentrics.com/docs/sst/get-started/#overview) Now that we have a fully deployed server Google Tag Manager container, it’s time to start using it. There are two things you need to do: 1. **Set up the client to send data to the server container**: change your website’s tag configurations to point to your new domain, instead of sending data directly to third-party services. 2. **Use consent signals in the server container**: make the service-level consent signals available to the server, so they can be used in trigger conditions for tags and transformations. The next sections of this guide explain step-by-step how to do these task. 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. ![Server-side tagging](https://usercentrics.com/docs/assets/sst/diagrams/diagram-server-side-tagging.jpg) ### **Configure web GTM with Google Analytics as the client-to-server data stream**[**¶**](https://usercentrics.com/docs/sst/get-started/#configure-web-gtm-with-ga4-as-the-client-to-server-data-stream) 1. (Optional) If you don’t already have one, **create a web container in** [**Google Tag Manager**](https://tagmanager.google.com/#/home). It’s very similar to the process described above, but make sure to select the Web container type. **Deploy it to your page following the instructions displayed in GTM**. ![Create web GTM container](https://usercentrics.com/docs/assets/sst/screens/10-create-web-gtm.png) 2. (Optional) This example will use Google Analytics 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** ![Add Google tag](https://usercentrics.com/docs/assets/sst/screens/11-add-gtag.png) 3. 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 **Add parameter** and then **add** `server_container_url` **as the name, and your container domain in the value field** (e.g. `https://demo.example.com`). ![Set server container URL](https://usercentrics.com/docs/assets/sst/screens/12-serve-container-url.png) 4. **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. ![Test data in server container](https://usercentrics.com/docs/assets/sst/screens/13-test.png) 5. If you see requests coming into the server container, it means your Google tag is correctly set up and you can **publish your web container changes**. If you’re already using the Google Analytics 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**. > [!TIP] > **The next step is making sure to** [**use consent signals in your server-side container**](/v1/docs/consent-in-server-gtm). > > A recommended (optional) step is to have your container serve your Google scripts (`gtm.js` and `gtag.js`). You can find more details about this in the next section. ### **Serve scripts from your container (optional, recommended)**[**¶**](https://usercentrics.com/docs/sst/get-started/#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 third-party services, and makes your setup more resilient to device restrictions. When doing this you can also use our resilient loader to load gtm.js from your subdomain and obfuscate the GTM ID to avoid it from being blocked by certain ad blockers. You can [find more information around our resilient script loader here](https://portal.document360.io/17f91ed2-e9be-4746-9f2b-1fa43f97e9b5/document/v1/view/e076c0c3-34c8-418a-bf80-37ab70f225df/en). To enable serving the Google Tag Manager script (`gtm.js`) and dependent ones like the Google tag (`gtag.js`) from your domain, follow these steps: 1. Add the **Google Tag Manager Web Container** client to your server container, select the web container IDs you enable and add the allowed Google Tag Manager container IDs, Google Analytics 4 measurement IDs, Floodlight and Google Ads conversion IDs , click **Save** and then **Submit** to publish your container changes. ![](https://cdn.document360.io/17f91ed2-e9be-4746-9f2b-1fa43f97e9b5/Images/Documentation/image(122).png?sv=2026-02-06&spr=https&st=2026-11-19T08%3A01%3A43Z&se=2026-11-19T09%3A01%3A43Z&sr=b&sp=r&sig=jcRiYBfGnIjoa2PttBR%2Fi%2F4jbyW5ESshKe%2FUjqpIfSA%3D) 1. 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 (like `demo.example.com`). ### Configure apps with GA4 as the client-to-server data stream #### **Step 1: Preparation of Apps** **Android** In your app’s `AndroidManifest.xml` , paste the following code. Change `APP_PACKAGE_ID` to your app's actual package identifier (all lowercase). ```java