Stape
Search
Try for free

What is server-side tracking?

Updated
Nov 12, 2024
Published
Jan 31, 2022
Also available in

Server-side tracking monitors users’ website activity and relies on cloud servers instead of the user's browser. It is trendy at the onset of the cookieless era. This blog post will explore server-side tagging, how it works, and its benefits and drawbacks compared to client-side tracking. So let’s get started!

Difference between client-side and server-side tracking

Before getting into the details of server-side tracking, let’s take a moment to discuss what client-side tracking is. This way, it will be much easier to grasp the difference between the two. 

What is client-side tracking? 

Client-side tracking is the most popular way of connecting websites with tracking platforms. It utilizes the user’s browser (client) to send information to the tag managing system or analytics platform. One of the most popular tag management systems is Google Tag Manager. After your site is connected with Google Tag Manager, you can use it to send information to any platform, like Google Analytics, Facebook, TikTok, Mailchimp, etc. 

how client-side tracking works

To make client-side tracking work, add Google Tag Manager (or any other tag management system) code to your website and, ideally, create a data layer. After that, tags and triggers that send information about user activity to third-party tools are set up. 

What is server-side tracking?

With server-side tracking, your website first sends data to the cloud server. Then the cloud server distributes data between third-party vendors and tracking platforms. The most popular server-side tracking platform is again Google Tag Manager. They released their server-side tagging type of tracking in 2020. 

A cloud server works as a proxy between the information you send to a third-party tool and your site (or any other data source). To use server Google Tag Manager, you need to set up a cloud server that should (but not must) utilize the subdomain of your website. Then, use server GTM requests to send information further to the tracking platforms.

how server-side tracking with a cloud server works

Server-side tracking benefits over client-side tracking

  • More accurate data collection and conversion tracking. Server-side tagging can help reduce data loss due to iOS restrictions and may also decrease the impact of ad blockers. It all happens for two reasons: using a custom domain for server-side tagging that sets first-party cookies and Stape custom loader that helps to make Google Tag Manager and Google Analytics resistant to ad blockers.
  • First-party cookies and extended cookie lifetime. When setting up a server container in Google Tag Manager, it is highly recommended to use a custom domain. With the help of a custom subdomain, you can set first-party cookies. Third-party cookies deprecation affects all the popular browsers, Chrome, Safari, Firefox, etc. If you’ve set up server-side GA and used a custom domain for your server GTM, cookies will live for 400 days.
  • Reduce the impact of ad blockers. If you use server-side tagging with the configured subdomain, tracking requests are sent from your primary domain, meaning ad blockers can't detect it.
  • Control what data each vendor receives. Conversely, with the help of server-side tagging, you control what data each vendor receives. They can access only the information you configured in the request.
  • Governance and control. Since server tracking allows you to completely control data flow, each vendor will receive only the information configured in your server-side tags.
  • Data enrichment. Server GTM and server-side tracking can enrich data. For example, you can track orders via phone in Google Ads or Facebook.
  • Improved website page load time. Reducing the number of tracking JavaScript on your site may have a massive impact on your organic positions. Many of Stape's clients decided to set up server-side tracking mainly for better page speed.
  • Hide Tracking IDs and Secret API keys. Anyone can see your tracking ID in the console or using a browser plugin with web tracking. Server-side tracking has the opposite situation - your tracking IDs are hidden. This may help prevent spam hits.

With Stape, you can set up tagging server URLs in one click - it's super simple. Plus, it saves you money. Stape’s hosting is around five times cheaper than GCP. Besides its cost and simplicity, server-side tagging with Stape has multiple advantages, like a custom loader, global CDN, logs, anonymizer cookie-keeper, multi-domains, preview header, account sharing, autoscaling, API, server zones, and more. 

Most common use cases of server-side tracking

Considering all the benefits server-side tracking has, it is no wonder it has numerous use cases. Let’s take a look at the most popular ones:

  • Facebook Conversion API. It allows you to send any event (standard and custom) from your server to the Facebook server. Facebook Conversion API helps track users who have opted out of tracking on iOS devices.
  • Server-side Google Analytics 4. Google says that server-side GA helps increase cookie lifetime. Since GA does not have event deduplication, you must use web or server tracking. If you want to use both, just use different GA properties.
  • Server-side Google Ads. Server-side Tag Manager allows you to move your Google Ads conversion tracking tags from the webpage to the server, which will help improve page load time and increase conversion tracking accuracy. Moving Ads tags onto a server also helps with performance issues for slower internet connections.
  • TikTok Events API. The TikTok Events API technology is similar to Facebook's Conversion API. It lists recommended events, event parameters, and user data that should be sent to TikTok servers. You can also use a test ID to test TikTok server events in real-time. TikTok also supports event deduplication.
  • Track offline data. Server-side tagging enables tracking offline conversions, such as phone orders, in-store purchases, and data from the CRM. It also lets you see leads progress through the sales pipeline.
  • Server-side email software integration. Unlike web tracking, server integration lets you integrate email software entirely with your site, including creating new contacts. Server-side integration speeds up your site's work because no third-party JavaScript runs in the user’s browser.

- Data security. Server-side tagging gives you fuller data control since data is processed and stored on your servers before it’s sent to third-party services.

- Privacy compliance. When you go with server-side tagging, you can ensure that only the necessary and compliant data is shared with third-party services.

  • Performance optimization:

- Improved page load times. By handling tracking and analytics on the server side, you can reduce the amount of JavaScript running in the user's browser, which results in faster page load times and improved user experience.

- Reduced client-side processing. Offloading data collection and processing to the server can reduce the load on the client side.

  • Custom data enrichment:

- Advanced data enrichment. Server-side tracking permits the integration of additional data sources, such as internal databases or third-party APIs.

- Complex data transformation. The server performs complex data transformations and calculations before sending the data to third-party services, ensuring cleaner and more accurate data.

- Refined attribution models. Extending cookie lifetimes and combining web and server-side data can achieve more accurate attribution models.

- Bypass ad blockers. Since the data is sent directly from your server, server-side tagging is less likely to be blocked by ad blockers.

  • Improve integration with other systems:

- Integration with internal systems like ERP, CRM, and other business intelligence tools.

- Custom workflows and automation to trigger marketing campaigns or operational alerts.

- Offline data integration. You can integrate offline conversion data, such as in-store purchases or phone sales, with online data to create a complete view of the customer journey.

Server-side tracking using server Google Tag Manager

There are several tools you can use to set up server-side tagging. Our choice is the server Google Tag Manager container. The main advantages of using sGTM, in our opinion, are:

  • Ease of use.
  • Transparency and convenience.
  • No additional costs. You should pay only for servers, with no fees for using the sGTM interface.
  • Version control system. Any changes can be easily undone and returned to an earlier state, as well as keep track of who made the changes, where, and when.
  • Multi-user mode.

If you want to set up Google Tag Manager server-side tagging on your website, we have a step-by-step manual on how to do it with our service.

Why Stape is the easiest and cheapest way to start with server-side tracking

Using Stape, you can set up server GTM in less than one minute, and we are the cheapest solution on the market. Stape is affordable because we buy servers in bulk and for an extended period. Plus, we optimize our servers to work only with Google Tag Manager.

Besides that, Stape has many other advantages:

1. Custom gtm.js and gtag.js loader. It helps you make Google Tag Manager and/or Analytics 4 scripts more resistant to ad blockers.

2. Global CDN. This allows for faster JS file serving by using a server that resides closer to your site visitor. This results in improved page speed, which might positively affect organic ranking.

3. Logs. Logs are a handy feature when setting up or troubleshooting server-side tagging. They help determine what data was sent to the server and how it was processed. For example, you can check if all purchase events had a 200 status (meaning they were correctly handled) or check all requests with a 500 response code.

4. Cookie keeper. Extend cookies when a person uses any browser with the latest version of ITP, which shortens cookies’ lifespans for responses from third-party IPs. You only need one thing to do: activate our power-up Cookie Keeper.

5. Anonimyzer. With this power-up, you can remove or anonymize user data from Google Analytics.

We have a separate blog post covering the benefits of Stape hosting for Google Tag Manager server.

How to set up server-side tracking with Stape

The first step when starting with server-side tagging is configuring the sGTM container. Using Stape, you can set up a tagging server for your sGTM container in one click. All you need to do is:

1. Open your WEB Google Tag Manager container https://tagmanager.google.com/.

Click Admin. Under the container column, click +

set up server gm

2. Type the container name, choose Server, and click Create.

set up server gm

3. Choose Manually provision tagging server, copy your container config and paste it in any text editor. We will need it for the next steps.

set up server gtm

4. Go to stape.io and create an account or log in.

create an account on stape

5. Click Create container on the top right. 

6. Enter your container details:

  • Container name. The name does not necessarily have to be the same as the container name in your server GTM.
  • Container configuration - paste Container Config that you copied from your Google Tag Manager Server Container.
  • Server location - select your server location based on the location of most of your clients. Location can not be changed later.
  • Click Create Container.
create container on stape

7. Choose a plan for your container. You can start with a Free plan. Click Continue with a Free plan.

stape pricing plans

8. 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 Google Tag Manager server-side setup was done correctly, you should see the status “Running”. 

running container on stape

Recommended. Set up custom domain:

  • Same origin
  • Subdomain
  • Default domain
types of custom domain configuration

We have a detailed blog post where we describe mapping a custom domain for the server Google Tag Manager container: using the same origin (Cloudflare and nginx).

But here, we will cover custom subdomain setup:

1. Open your sGTM container on Stape, scroll down to “Domains” and click Add custom domain

add a custom domain

2. Write a custom domain.

3. You will see DNS records that you should add.

The DNS record depends on the server location and CDN option you choose. 

  • Disable CDN - choose not to use any type of CDN.
  • Stape Global CDN - loads scripts from a server closer to the user visiting your website.
  • Own CDN - helps to tag server URLs from the same IP as your website. It gives the ability to set cookies that Safari can not shorten.
custom domain setup with stape
custom domain setup with stape

The DNS records you should configure vary depending on the server location and your selected CDN settings. You will see DNS records that you should add inside your stape.io container.

custom domain setup with stape

4. Log in to your DNS account and add records you see in your stape.io account. Below is an example of DNS setup for CloudFlare. Open the DNS setting of the required domain and click Add record.

add DNS record in cloudflare

 Then, write the records you see in your stape.io account. Ensure that the proxy is turned off. 

example of dns record

Usually, it takes 2-3 hours to verify the custom domain. For some DNS providers, verifying records might take up to 72 hours. We will email you once the custom domain is verified or any error is detected. If there is an error with the verification, please follow this instruction on how to verify custom domain verification.

5. Once the custom domain is verified, go back to the Google Tag Manager Server container → Choose your server container → Admincontainer settings → paste tagging server URL.

custom domain setup with stape

6. If you use a custom domain, updating the Web GTM script on your website is highly recommended. This tweak will load gtm.js from your domain. To do so, replace the default domain googletagmanager.com with the custom domain you set up in the previous step.

pase code to the website

And all is done!

From our point of view, configuring a custom domain with the same origin domain is the best option because it helps to prolong cookie lifetime in all browsers. However, this method is technically advanced and requires CDN or a load balancer. If you want to configure the same origin domain, follow this guide on our blog.

If you can't configure the same origin domain, we have solutions for prolonging cookie lifetime in Safari: Own CDN and Cookie Keeper.

To sum up

By mastering server-side tracking, you can gain valuable insights into user behavior that can form the basis of your marketing strategies and improve your website's performance.

Our team of experts is always happy to help new users get started with tracking and answer any questions.

For high-volume websites, we offer custom plans. Feel free to use the pricing calculator to estimate the best plan for your site.

Tagged with:gtm server

Try Stape for all things server-sideright now!