webtracking.org
concepts

Server-side tracking: architecture, benefits, and the tradeoff

Client versus server collection, how sGTM and Conversions API architectures actually work, what moving server-side fixes — and the blocker-circumvention tradeoff stated plainly.

last verified 2026-07-11

“Server-side tracking” is two related architectures that get conflated. The first is a server-side proxy: the browser still observes user behavior, but sends events to an endpoint you control, which forwards them to vendors. The second is true server events: your backend emits events from things it already knows — an order record, a subscription webhook — with no browser involvement at all. Most production setups combine both. This guide covers the architecture, what it genuinely fixes, and the tradeoff that deserves to be stated plainly rather than buried in marketing copy.

The client-side baseline

In the default architecture, a tag in the page constructs a beacon and sends it directly to each vendor: browser → google-analytics.com, browser → facebook.com/tr, one request stream per vendor. Three structural weaknesses follow:

  • Anyone in the browser can interfere. Content blockers block requests to known vendor hosts; Safari’s ITP caps the lifetime of cookies set via document.cookie (7 days generally, 24 hours in some link-decoration cases, as of mid-2026), so vendor identifiers on Safari expire quickly and returning users reappear as new.
  • You don’t control the payload. Each vendor’s tag decides what to collect; auditing what actually leaves the page requires decoding beacons (the Beacon Decoder exists for exactly this).
  • The page pays the cost. Every additional vendor is another script and another request on the user’s device.

Architecture 1: the server-side proxy (sGTM pattern)

Server-side Google Tag Manager is the reference implementation of the proxy pattern; Tealium EventStream and similar products occupy the same slot. The moving parts:

  1. The browser sends one stream to a first-party endpoint. The web container is pointed at your own subdomain instead of the vendor:

    gtag('config', 'G-XXXXXXX', {
      server_container_url: 'https://mp.example.com'
    });
  2. A server container receives it. In sGTM, a client claims the incoming request and parses it into a common event object. The container runs on infrastructure you operate (Cloud Run, App Engine, or any host), behind mp.example.com.

  3. Server-side tags fan out to vendors. Each tag maps the event object onto a vendor’s API — GA4, Meta, ad platforms — from your server, over connections the browser never sees.

  4. You transform in the middle. Strip parameters, redact PII, enrich from internal data, validate against your event schema, and drop what fails — before any vendor receives anything.

Because the endpoint is a genuine first party, the server can set identifiers in HTTP response headers (Set-Cookie) rather than JavaScript — and HTTP-set first-party cookies from your own infrastructure are not subject to ITP’s script-cookie caps. One caution: WebKit has progressively extended its caps to disguised third parties — CNAME-cloaked subdomains and, later, subdomains resolving to third-party infrastructure. As of mid-2026, the longer cookie lifetime holds up best when the endpoint runs on infrastructure attributable to your own domain, not a thin CNAME to a vendor.

Architecture 2: true server events (CAPI pattern)

Meta’s Conversions API is the canonical example; Google’s enhanced conversions and TikTok’s Events API are the same shape. Your backend posts conversion events directly to the vendor:

{
  "data": [{
    "event_name": "Purchase",
    "event_time": 1752244327,
    "event_id": "ord-10023",
    "action_source": "website",
    "user_data": { "em": ["<sha256 of normalized email>"] },
    "custom_data": { "currency": "USD", "value": 129.00 }
  }]
}

Two details carry most of the engineering weight:

  • Deduplication. If the browser pixel and the server both report the purchase, the vendor needs to count it once. Meta deduplicates on matching event_name + event_id across the two channels — which means your client and server must share an event ID, generated once per action and threaded through both paths.
  • Hashed match keys. Server events identify users via normalized, SHA-256-hashed identifiers (email, phone). Hashing must happen before the data leaves your systems (the PII Hasher demonstrates the normalization rules) — and note that hashing is pseudonymization for transport, not anonymization: the vendor matches the hash back to a known person.

What server-side genuinely fixes

  • Data loss from blockers and ITP. A first-party endpoint on your own domain is not on vendor blocklists, and server-set cookies persist longer on Safari. Measurement completeness on blocker-heavy and Safari-heavy audiences improves — this is the honest core of every sGTM pitch.
  • Payload control. The vendor receives exactly the fields your server forwards — you can redact, truncate, and allowlist. Client-side, the vendor’s own script decides.
  • PII and geography. You can strip or hash identifiers, drop IP addresses, and choose where the proxy runs — relevant to teams with data-residency obligations.
  • True server events are more reliable than any browser signal. A purchase emitted from the order system has no race conditions, no blockers, and survives page abandonment after payment.
  • Page performance. Fewer third-party scripts and requests in the page; fan-out moves to your server.

What it does not fix

  • Consent obligations. ePrivacy/GDPR consent requirements attach to the processing, not the transport. An event collected without a valid basis is non-compliant whether it travels through a vendor’s endpoint or yours — and Global Privacy Control and consent state must now be enforced in your server logic, because the browser can no longer enforce anything.
  • Blocklists adapt. Filter lists target default sGTM paths and request signatures; as of mid-2026 the well-known defaults are widely listed, and the countermeasure–counter-countermeasure cycle continues. First-party proxying reduces blocking; it does not end it.
  • Identity gaps. Cross-device fragmentation and logged-out anonymity are untouched.
  • Operational cost. You now run collection infrastructure: uptime, scaling, schema versioning, and debugging that spans browser, container, and vendor API.

The tradeoff, stated plainly

The mechanism by which server-side collection improves data completeness is that it makes tracking harder for users to see and harder for their tools to stop. A user who installed a content blocker made a deliberate choice; first-party proxying routes around that choice. Browser devtools show one opaque request to your domain instead of an inspectable request per vendor — the in-browser transparency that tracking-prevention tools rely on (documented across our privacy pillar) does not extend past your server.

That is not an argument that the architecture is illegitimate — moving enforcement server-side also enables stronger privacy engineering than any client-side setup: guaranteed PII redaction, consent checked before any vendor is contacted, GPC honored uniformly, vendors reduced to a minimal, audited payload. The same pipe carries both outcomes. What distinguishes them is operator policy, which is exactly why the Privacy Scorecard grades vendors on consent honoring, data minimization, and transparency rather than on architecture alone: server-side tracking concentrates capability — and therefore accountability — in whoever runs the server.

Deciding whether to adopt it

Adopt server-side collection when at least one of these is true: measurable beacon loss on audiences you are paid to measure; contractual or regulatory requirements around PII and residency that client-side tags cannot meet; or conversion signals (refunds, offline sales, subscription renewals) that only exist server-side. Skip it while your client-side foundation is unsound — a proxy faithfully forwards whatever mess the data layer contains. And if you adopt it, adopt the accountability with it: publish what you collect, enforce consent and GPC at the server, and audit your own endpoint the way you would audit a vendor’s.