Stape
SearchTry for free

Server-side tagging guide: benefits and tools to use

Maryna Semidubarska

Maryna Semidubarska

Author
Updated
May 28, 2025
Published
May 27, 2025
  • Marketers lose up to 30% of conversion data due to browser restrictions and ad blockers.
  • Server-side tagging works by sending event data through a cloud server instead of the user's browser.
  • Server-side tagging is the approach to use to avoid data loss, improve tracking accuracy, and comply with privacy rules.

Client-side tracking isn't delivering as good a result as it used to. Ad blockers and browser privacy updates block data from being collected and sent to ad and analytics platforms. 

Server-side tagging solves this by introducing a middleware cloud server, helping you collect more complete data, set more resilient cookies, and comply with legal requirements.

This guide explains how server-side tagging works, how to set it up, and which tools to use to do it right.

Let's dive in.

What is server-side tagging?

Server-side tagging means the data is still collected in the browser, but it doesn't go straight to platforms like Meta or Google.

Instead, it first passes through a cloud server where your Google Tag Manager (GTM) server container processes this data and sends it to the platforms or tools you use, such as Meta, Google Analytics, or others.

How server-side tracking works
How server-side tracking works

To make this setup work, you need somewhere to host that cloud server. 

That's where Stape helps: it gives you a ready-to-use environment for your GTM server container without the need to set up your own infrastructure.

Server-side tagging improves data accuracy and privacy by reducing reliance on the user’s browser and avoiding some data loss due to browser limitations. 

Benefits of server-side tagging

More marketers are moving away from browser-based tracking in favor of server-side setups. Those are the main reasons why they do so: 

  • More accurate and complete data: events are funneled through your own server (often via a custom domain), so fewer conversions are lost to browser restrictions or ad blockers. 

First-party cookies set via your server can also last much longer, which helps track where your conversions really come from. For example, analytics cookies via server-side can live for up to 400 days instead of being deleted after a week. 

And since tracking requests come from your domain, ad blockers are less likely to filter them out, resulting in more complete conversion data.

  • Improved page performance: offloading tracking scripts to the server means less JavaScript running in the browser, often leading to faster page load and a better user experience.
  • Greater data control and privacy: with server-side tagging, you act as the gatekeeper of what data gets sent to each vendor. You can filter or anonymize personal information (for example, remove or hash user identifiers like emails or phone numbers) before it leaves your server. This helps meet CPRA in California, VCDPA in Virginia, GDPR requirements in the EU, and other privacy laws.

Server-side tagging vs server-side tracking

You might often see "server-side tagging" and "server-side tracking" used interchangeably, but technically, they describe two different approaches.

Server-side tagging still starts in the browser. 

The data is collected there, but instead of being sent directly to analytics or ad platforms, it first passes through a cloud server. 

That's where the tags run, data gets filtered or enriched, and then forwarded to platforms like Google Analytics 4 (GA4) or Meta.

Server-side tracking, on the other hand, skips the browser completely. 

All the data comes directly from backend systems or other servers and is then sent to the analytics or ad platforms with no interaction from the user’s device at all.

Server-side tagging vs server-side tracking
Server-side tagging vs server-side tracking

In practice, many marketers and platforms don't draw a clear line between the two, so the terms are often mixed.

You can use either one, but if you want to be precise, tagging is browser-based with server processing, and tracking is fully server-to-server.

How server-side tagging with GTM works

In a traditional client-side setup, your website’s GTM web container runs in the browser and sends data straight to third-party services (e.g., Google Analytics, Facebook, etc.). 

In server-side tagging, you introduce a GTM server container on a cloud server that sits between your website and those third-party platforms. Here’s the basic flow:

In server-side tagging, the user’s browser sends tracking events to your GTM server container, which then forwards them to third-party tools like GA4 or Facebook. This creates a first-party data stream controlled by you.

When a user triggers an event (say, a page view or a purchase), the browser sends that data to your server container’s endpoint (often a subdomain like ss.yourdomain.com). 

A Client component parses the incoming request inside the server container and makes the data available to your configured server tags

Those server-side tags then forward the data to the target platforms (e.g., Google Analytics, Google Ads, Facebook) via their APIs. 

Let's set up server-side tagging

Setting up server-side tagging may sound complex, but Stape has adapted this process for marketers and business owners. 

Simply follow these steps to set up your server-side tagging:

1. Create a GTM server container

  • Access GTM: go to Google Tag Manager.
  • Create container: click on Admin > + under the Container column.
  • Configure container: name your container, select Server as the target platform, and click Create.
Create sGTM container
Create sGTM container
  • Provision server: choose Manually provision tagging server and copy the provided Container Config.

2. Deploy the container on a server via Stape

  • Sign up/Login: go to Stape and log in or create an account.
  • Create container: click on Create Container.
  • Enter details: provide a container name, paste the container config from GTM, select your server location, and click Create Container.
Input container configuration on Stape
Input container configuration on Stape
  • Deployment: Stape will deploy a cloud server and host your GTM container. The status will change to Running once setup is complete.

3. Set up a custom domain

  • Access domains: in your Stape container, scroll to the Domains section and click Add custom domain.
  • Enter domain: input a subdomain (e.g., ss.yourdomain.com).
  • Configure DNS: Stape will provide DNS records. Add these to your domain registrar to point the subdomain to your server container.
  • Verification: once DNS changes finish updating, the custom domain will be verified.
Using a subdomain
Using a subdomain

4. Adjust your web GTM to send data to the server

  • Open web container: in GTM, access your Web container.
  • Create tag: add a new tag (e.g., Google Analytics: GA4 Event).
  • Configure tag: in the tag settings, set the Transport URL to your server container's URL (e.g., https://ss.yourdomain.com).
  • Triggers: set appropriate triggers for your tags to ensure events are sent to the server container.
Tag configuration
Tag configuration

5. Configure clients and tags in the server container

  • Access server container: in GTM, open your Server container.
  • Add clients: go to Clients, click New, and select the appropriate client (e.g., GA4).
  • Set up tags: under Tags, create new tags corresponding to the platforms you wish to send data to (e.g., Facebook Conversions API, LinkedIn Conversions API).
Tag configuration
Tag configuration

6. Test and publish

Use GTM's preview/debug mode for both your web and server containers. Trigger some test events (like a pageview or test conversion) and verify in the server container's debug panel that the events are received and forwarded correctly. 

Once everything looks good, publish the changes in both containers. 

Your site is now live with server-side tagging.

In our blog post, there's a more detailed description and steps to perform GTM testing.

Stape for server-side tagging

Running server-side tagging on your own sounds good until you look at the monthly cost, setup time and effort, and maintenance. That’s why marketers and business owners choose a managed solution like Stape.

Stape provides you with:

  • A fully set-up cloud server

No need to configure Google Cloud Run, self-host, or manage scaling. 

Stape provides a ready-to-use cloud server for your GTM server container, so you can skip the backend setup and start tracking immediately.

  • Simple, clean dashboard

Everything you need to manage your setup is in one place. You can see your container status, connect a domain, activate power-ups, and check logs.

  • Affordable plans

Hosting your own server can easily go over $100/month. With Stape, you can start for free and then continue at $20/month or scale with a bigger plan.

  • Built-in power-ups

You can use advanced features without custom dev work:

  1. Cookie Keeper: keeps first-party cookies valid for up to 400 days, which is useful as browsers delete them after 3-7 days.
  2. Custom Loader: changes the names of your tracking scripts so ad blockers don't recognize and block them.
  3. Anonymizer: lets you filter or remove personal data before sending it out, so you stay compliant with data protection legal requirements.
  4. Multi-domain support: tracks users across sites like shop.yoursite.com and blog.yoursite.com as one session, not separate visits.
  • Templates for GTM

Stape is also one of the largest contributors to the GTM Template Gallery.

You'll find ready-to-use templates for GA4, Facebook, TikTok, Matomo, Piwik PRO, and more,  all designed to simplify server-side setups and reduce manual work.

  • Global CDN and custom domains

Your web container is now downloaded through a global CDN, a group of servers worldwide that helps pages load faster by using the server closest to your visitor. 

You can (and should) also connect a custom subdomain, like anything.yoursite.com, to send data through your own domain and improve tracking accuracy.

  • Support when you need it

There’s a clear knowledgebase and documentation in the Helpdesk and a support team ready to help or advise at any moment. 

Client-side vs server-side tagging

Client-side tagging means your tracking tags run in the user’s browser. 

When someone visits your site or takes an action, the browser sends that data directly to platforms like GA4 or Meta. 

This type of tagging has a lot of limits. Ad blockers, browser privacy restrictions can block your requests or cause you to miss out on important information, which leads to data loss.

Server-side tagging, like the one provided by Stape, works differently. 

Instead of sending data straight from the browser, it first goes to your cloud server, usually through a custom subdomain like anything.yoursite.com. 

From there, the server forwards the data to ad and analytics platforms. 

This setup gives you more control over what data gets shared and helps you stay compliant with privacy laws. It also improves data accuracy by avoiding browser-related issues, so ad platforms get the right signals to adjust your campaigns and reach people who are more likely to convert.

Client-side vs server-side tagging
Client-side vs server-side tagging

GTM server-side tagging and GDPR compliance

Server-side tagging helps protect users' privacy by giving you more control over how and where user data is used.

Instead of sending data straight from the browser to third-party platforms for ads and analytics, it first goes to your cloud server. 

There, you can remove or anonymize personal details like IP addresses or emails before forwarding them. You can also choose a server location that keeps data within the EU, which supports GDPR's localization requirements.

An important thing to add is the user's consent. You know, this basic window "We use cookies", where the user chooses to agree or to refuse. 

This way, if the user opts out, their data won't be used, and you will be compliant with GDPR rules

GTM server-side tagging and cookies

Cookies are an important tool for gathering user data, and server-side tagging helps you make the most of them by improving how they're stored, refreshed, and recognized.

Here's what it changes and why it matters for your tracking:

  • First-party cookies with longer lifespan: with a server-side setup using your own domain, tracking cookies become first-party ones. 

Browsers are less likely to block or delete them. 

Analytics or advertising cookies set via your server can last for months (up to 13 months) rather than being deleted in a few days, as is the case with browser tagging. 

This provides much better continuity for tracking returning visitors.

  • Dealing with ITP (Safari restrictions): Safari's Intelligent Tracking Prevention still limits the duration of even first-party cookies. 

To bypass this, Stape's Cookie Keeper power-up continuously refreshes your important cookies so Safari doesn't expire them after a week. 

  • Own CDN: routes your tagging domain through the same IP as your main site.

This helps browsers like Safari treat cookies as truly first-party, which improves their lifespan and accuracy.

  • Same-origin domain: setting your tagging path on the same domain as your site (like yoursite.com/sgtm) helps ensure browsers don't downgrade cookies or block tracking.
  • Sustainable tracking: third-party cookies (like the ones from your ad platforms) are gradually being removed from browsers.

This makes a first-party, server-side setup even more important for keeping your tracking and attribution accurate over time.

Extra tools to use for server-side tagging

Server-side tagging gives even more results when you pair it with the right extras. 

These Stape tools help you set things up, keep your user data clean, and deal with ad blockers or disappearing cookies so everything just works like it should:

  • Gateways for dedicated platforms

If you’re tracking for a specific ad platform, a dedicated gateway makes setup faster and easier. 

Stape offers preconfigured gateways that automatically send events from your cloud server to the platform you choose without any manual tagging.

  • Meta Conversions API Gateway: sends events like purchases and leads from your server to Meta using Conversions API. Hosted by Stape, no backend setup is required.
  • Stape Gateway: built for GA4 and Google Ads. It installs core tags in your server container automatically.
  • TikTok Events API Gateway: helps you send server-side events to TikTok for better attribution and campaign optimization.
  • Snapchat CAPI Gateway: tracks conversions on Snapchat even when browser tracking is blocked.

Each gateway is tailored to its platform’s API, so you get accurate event tracking with less configuration.

  • Monitoring

Monitoring shows if key events (like purchases or sign-ups) suddenly stop working.

For example, if no "Add to Cart" events are recorded for hours, even though people are using your site. 

You'll get notified right away, so you can fix the issue quickly by checking your GTM tags and triggers, using preview mode to test events, or reviewing recent site changes that may have influenced the setup.

  • Stape Analytics

Once server-side tagging is running, you will probably want to see what difference it actually makes. 

Stape Analytics measures how much data was recovered from ad blockers and browsers with tracking preventions.

For example, in a 10-day test with over 7 million requests, 3.29% of events were recovered from ad blockers and 20.71% from tracking prevention mechanisms like Safari ITP.

You'll get your data breakdowns directly inside your Stape account, no extra dashboards or integrations are required. 

Common issues with server-side tagging and how to resolve them

Sometimes, things don't work as expected. Usually, it is because of a small setup detail. Here's what to check first and how to get things back on track:

  • GTM server 404/403 errors: if your tracking calls return a 404, the server container endpoint isn't found or published. 

A 403 indicates permission issues (often using the wrong container ID or a missing authorization token). 

How to solve: make sure you have published your server container and that your web container is pointed to the correct server URL/ID.

How to solve: use a custom domain to make requests appear first-party. 

Then double-check your web tags, they need to point to your server container URL and include all required parameters (like event name, value, currency, or event ID) so the server receives the whole event. 

Use GTM's preview mode to test if the tag fires correctly.

  • CORS or CSP blocking the requests: Cross-Origin Resource Sharing (CORS) or Content Security Policy (CSP) settings on your site or browser can block requests to your server container.

How to solve: make sure your custom domain is correctly configured to allow cross-origin requests. 

You may need to update server headers or CSP rules to allow traffic between your web container and your server container.

  • Duplicate or missing conversions: if you're using both client and server tracking, you might see the same conversion counted twice or not at all.

How to solve: add event deduplication using the same event ID in both browser and server tags (especially for platforms like Meta). 

If conversions are still missing, use GTM's debug mode to check if the server tag fired and the event was received.

FAQs 

Who should consider server-side tagging?

It's a good solution for anyone who needs accurate tracking: eCommerce brands, agencies, SaaS teams, and publishers. 

If you run paid ads and want better attribution or more control over what data is shared, it's worth it. Especially now that browsers remove cookies and ad platforms expect cleaner, more reliable data.

Do I need technical skills to set up server-side tagging?

Not really. Stape makes it easy: you don’t need to code or manage your own server, Stape provides hosting and prebuilt templates.

Is server-side tagging mandatory?

No, but it's quickly becoming the smarter option. Client-side tracking is missing more data because of browser privacy updates, cookie restrictions, and ad blockers. 

Server-side gives you cleaner insights and helps you stay compliant with privacy regulations. 

What is an example of server-side tracking?

With server-side tagging, your site sends data to your cloud server first, then to GA4. This avoids browser issues and gives you better control over what's tracked.

What is the difference between GTM and sGTM?

GTM runs in the browser. sGTM runs on a server. They work together: the browser sends data to the server, and the server forwards it to your tools like GA4 or Meta.

Want to start on server-side?Register now!

author

Maryna Semidubarska

Author

Maryna is a Content Manager with expertise in GTM and GA4. She creates clear, engaging content that helps businesses optimize tracking and improve analytics for better marketing results.

Comments

Try Stape for all things server-sideright now!