TL;DR
- WebKit deletes cookies written by JavaScript in Safari after 7 days without user interaction, or caps them at 24 hours after a click from a tracker-decorated link; server-set cookies can last longer only if the tagging server shares the site's origin or IP range.
- Meta deduplicates Pixel and Conversions API events by matching event name and event ID, and only when both arrive within 48 hours of each other.
- Google's Cloud Run guide for server-side Tag Manager recommends at least 2 instances in production; real hosting cost varies with traffic, region and instance count.
- Consent mode v2 adds ad_user_data and ad_personalization; non-Google tags in a server container need their own consent rules because they do not read those signals.
Server side tracking means your website sends measurement data to a server you control, and that server forwards it to Google Analytics 4, Google Ads, Meta, TikTok and other platforms, instead of every vendor's tag running in the visitor's browser and calling home on its own. It gives you more control over what each platform receives, longer-lived first-party cookies when it is set up correctly, and a clean route for conversion APIs, but it does not make tracking immune to consent choices, ad blockers or Safari's privacy rules.
This guide explains how server side tracking works with a server-side Google Tag Manager container, what it fixes and what it leaves untouched, how it feeds the Meta Conversions API, Google Ads enhanced conversions and the TikTok Events API, how consent mode carries through, and what running it costs in time and hosting. It ends with a plain test for whether a smaller site needs it at all.
Server side tracking vs client-side tags
In a classic client-side setup, the browser loads a container (for example a web Google Tag Manager container) and then loads a separate script for each vendor: the GA4 tag, the Google Ads tag, the Meta Pixel, the TikTok Pixel and so on. Each script collects data and sends its own request from the visitor's device directly to that vendor's domain. The browser does all the work, and each vendor sees the visitor's IP address, user agent and any cookies its script can read.
With server side tracking, the browser sends one stream of events to an endpoint on your own infrastructure, usually a subdomain such as metrics.yoursite.com or a path on your main domain. A tagging server receives those requests, turns them into a common event format, and then decides which vendors get which fields. The vendor tags run on the server, not in the browser.
Three practical differences follow from that design:
- Fewer scripts in the browser. Each vendor pixel you move server-side is one less third-party script competing for the main thread, which can help page speed on script-heavy sites.
- Control over the payload. The server can drop IP addresses, strip query parameters that carry personal data, or add values the browser never had, such as profit margin from your backend.
- A first-party context. Requests go to your domain, and cookies can be set by your server in an HTTP response rather than written by JavaScript, which matters for Safari (covered below).
How a server-side GTM container works
Google Tag Manager offers a server container type alongside the familiar web container. The flow has four moving parts.
1. The tagging server
A server container runs on a cloud host. Google's own setup guides cover Google Cloud Run, and the container image can also be run on other clouds or through managed hosting providers. You map a custom domain to it so the browser talks to a first-party address.
2. Clients
In a server container, a "client" is the piece that listens for incoming HTTP requests and claims the ones it understands. The built-in GA4 client recognises requests in the GA4 measurement format. When a client claims a request, it parses it into an event data object: event name, parameters, user properties, client ID and so on.
3. Tags and triggers on the server
Server-side tags read that event data object and send it on. A GA4 tag forwards it to Google Analytics, a Google Ads conversion tag sends conversions, and community templates in the Tag Manager gallery handle Meta's Conversions API and TikTok's Events API. Triggers decide which tags fire for which events, the same way they do in a web container.
4. The web container change
On the website, the Google tag is pointed at your tagging server URL instead of Google's default collection endpoint. From then on the browser sends GA4-format hits to your server, and the server fans them out. Most teams keep some tags in the web container, because not every vendor has a server-side equivalent.
Google also provides a preview server so you can debug the server container in Tag Manager's Preview mode, showing each incoming request, which client claimed it, and what each tag sent out.
First-party domain and cookie lifetime
Cookie lifetime is the most common reason people adopt server side tracking, and also the most misunderstood.
Apple's Intelligent Tracking Prevention (ITP) in Safari limits cookies written by JavaScript through document.cookie. WebKit documents that these script-written cookies are deleted after 7 days without user interaction with the website, and that their expiry is capped at 24 hours when the visitor lands from a URL carrying link decoration, such as a click ID, from a domain classified as a tracker. A Safari visitor who returns after that looks like a new user to an analytics tag that relies on a JavaScript cookie.
Cookies set by a server in an HTTP response with the Set-Cookie header are treated differently, which is why a first-party tagging server can extend the life of an identifier such as the GA4 client ID. There is a catch. WebKit also caps the expiry of cookies set in the HTTP response at 7 days when it detects third-party CNAME cloaking or IP address cloaking. If metrics.yoursite.com resolves to infrastructure that WebKit treats as a third party, the extended lifetime can disappear.
The practical answer is a same-origin or matching-IP setup: route a path such as yoursite.com/metrics through the same load balancer or CDN as the website, so the tagging server sits behind the same IP addresses. Google documents a same-origin serving option for exactly this reason. If you only map a subdomain to a separate cloud host, check the cookie expiry in Safari's developer tools after a few days rather than assuming it worked.
What server side tracking does and does not fix
Ad blockers and privacy browsers are the area where expectations run furthest ahead of reality.
- Blocklists by domain. Many blockers filter requests to known vendor domains. Sending events to your own domain avoids that specific filter. Blockers that also match on URL patterns, script names or request payloads can still catch a first-party endpoint, and filter list maintainers do add common server-side paths.
- Blocked loader script. If the browser never loads gtag.js or the GTM web container, nothing is sent to your server either. Server side tracking starts with a browser request, so a blocked loader still means a missing hit.
- Consent refusal. If a visitor declines analytics or advertising storage, the server must respect that. A server-side setup is not a way around a consent banner, and using it that way creates legal exposure under laws such as Thailand's PDPA and the EU's GDPR.
- Lost click IDs. Some browsers strip known click-ID parameters from URLs in private modes. A server cannot recover an identifier that never reached the page.
What it does improve is data quality inside the consent you have: more stable client IDs where cookie rules allow, fewer requests lost to domain-level blocking, and the ability to enrich and clean data before vendors see it.
How it feeds conversion APIs
The second strong reason for server side tracking is that the major ad platforms now accept conversions server to server, and they match users better when you send hashed customer data alongside the event.
Meta Conversions API
The Meta Conversions API (CAPI) receives events from your server. Meta recommends running it alongside the Meta Pixel, not instead of it. When both send the same event, Meta deduplicates them using the event name and an event ID: the Pixel's eventID must match the API's event_id, and the Pixel's event must match event_name. Meta's documentation states events are only deduplicated if they arrive within 48 hours of each other. If the IDs do not match, a purchase is counted twice and reported results inflate.
Google Ads enhanced conversions
Enhanced conversions send first-party customer data, such as an email address or phone number, normalised and hashed with SHA-256, together with the conversion. Google uses the hashed values to match the conversion to a signed-in Google account. A server container can attach this data from the event payload so the browser tag does not have to expose it in page source.
TikTok Events API
TikTok's Events API works on the same principle as Meta's: server events and Pixel events for the same action share an event ID so TikTok can deduplicate them.
In all three cases the server-side container is a convenient router, but the hard part is upstream: the website or backend has to expose a reliable order ID, a hashed or hashable email, and consistent event names. Without those, server events add noise instead of signal.
Consent mode handling
Google consent mode passes the visitor's choices to Google tags through four signals: ad_storage, analytics_storage, ad_user_data and ad_personalization. The last two were added in consent mode v2, which Google required for advertisers using European user data from March 2024.
When the web Google tag sends events to a server container, the consent state travels with each request, and Google's server-side tags read it and adjust their behaviour. Non-Google tags in the server container do not interpret Google's consent parameters automatically. You need triggers or template settings that block, for example, the Meta CAPI tag when advertising consent is denied. This is the step most often missed, and it is the one a privacy audit will look at first.
Hosting cost and maintenance
Server side tracking moves cost from "free" browser execution to infrastructure you pay for. Google's Cloud Run guide recommends running at least two instances in production to reduce the risk of losing data during an outage, and it treats the maximum instance setting as your worst-case spend ceiling. Google publishes an approximate per-server monthly figure in that guide, but real cost varies with traffic volume, region, number of instances, logging and egress, so treat any number as a starting estimate for your own account rather than a quote. Managed tagging-server providers charge on their own request-based plans, which also vary.
The maintenance load is easy to underestimate:
- Container image updates, which Google releases periodically and which you need to deploy.
- Monitoring for errors and dropped requests, ideally with an alert on request volume.
- Template updates when Meta or TikTok change their API versions.
- Re-testing deduplication after any change to checkout or order-confirmation pages.
The table below compares the two approaches on the points that usually decide the choice.
| Factor | Client-side tags only | Server side tracking |
|---|---|---|
| Where vendor code runs | Visitor's browser, one script per vendor | Your tagging server; browser sends one stream |
| Safari cookie lifetime | JavaScript cookies deleted by ITP after 7 days without interaction (24-hour expiry after decorated links) | Server-set cookies can last longer if the server shares the site's origin or IP range |
| Consent handling | Consent mode in the browser | Consent state must be passed and enforced for every server tag, including non-Google ones |
| Running cost | No hosting cost | Cloud hosting or managed plan; varies with traffic and setup |
| Skills needed | Tag Manager and analytics | Tag Manager plus cloud, DNS and API debugging |
When a small site does not need it
Server side tracking pays off when measurement quality affects ad spend decisions. A site may not need it yet when:
- Monthly ad spend is small enough that a few percent more matched conversions would not change bidding decisions.
- Conversions happen offline, by phone or in LINE chats, where an offline conversion import or CRM integration closes more of the gap than a tagging server.
- Nobody on the team can monitor a cloud service and respond when it fails. A broken tagging server loses data silently.
- The basics are not in place: GA4 key events are wrong, consent mode is missing, or purchase events fire twice. A server will forward the same errors faster.
For many smaller accounts, a clean GA4 setup with correct consent mode, enhanced conversions configured in the browser tag, and the Meta Pixel plus a platform-native CAPI integration (most ecommerce platforms offer one) covers most of the benefit with no hosting to run.
What this means for Thai marketers
Two local factors shape the decision. First, a large share of Thai purchase journeys move from an ad to LINE or Messenger, then close in chat. Server side tracking cannot see that conversation; the gain there comes from sending CRM or chat outcomes back to Meta and Google Ads as offline or server events with a shared ID. Second, Thailand's Personal Data Protection Act (PDPA) requires a lawful basis for processing personal data, so sending hashed emails through CAPI or enhanced conversions should sit behind consent and a privacy notice that mentions it. A server container makes that enforcement easier to centralise, but only if the consent rules are actually built into it.
If you run Google Ads and Meta for a Thai ecommerce store, the order of work is usually: fix GA4 events and consent, add enhanced conversions, add CAPI with deduplication, then consider a server container to consolidate and extend cookie life. The GA4 setup and migration service covers the measurement foundation, and the bidding side is handled within Google Ads management and Facebook and Meta ads management.
FAQ: server side tracking
Is server side tracking the same as server-side tagging?
Yes, in everyday use the two terms describe the same setup. "Server-side tagging" is Google's name for running Tag Manager tags in a server container, and "server side tracking" is the broader term that also covers direct API integrations such as the Meta Conversions API sent from a backend.
Does server side tracking bypass cookie consent?
No, and it should not be used that way. Consent choices still apply, and the server container must enforce them for every tag, including non-Google tags that do not read consent mode signals on their own.
Will server side tracking stop ad blockers from blocking GA4?
Partly at best. It avoids blocklists that match on vendor domains, but blockers that match URL patterns or block the loader script in the browser can still stop the data before it reaches your server.
Do I still need the Meta Pixel if I use the Conversions API?
Meta recommends using both together. The Pixel captures browser signals the server cannot see, and matching event IDs let Meta deduplicate events received within 48 hours of each other.
How much does server side tracking cost to run?
It depends on traffic, hosting region, the number of instances and whether you use a managed provider. Google recommends at least two Cloud Run instances in production, so budget for ongoing hosting plus the time to monitor and update the container.
If you are weighing server side tracking against simpler fixes, start with an audit of what your current tags actually send. Relevant Audience can review your GA4, Google Ads and Meta setup and tell you which step closes the biggest measurement gap for your budget.







