d8a .tech
Data Analytics

Why You're Losing Marketing Data - and How the Tracking Stack Fixes It

Divine Data Team
#analytics#tracking#server-side#GA4#martech
Feature image

You open Google Analytics, look at last month’s sessions, and quietly trust the number. Most marketers do. It feels like the truth.

It usually isn’t. Depending on your audience, somewhere between 15% and 40% of your tracking data never arrives at all. It leaks out along the way - blocked by ad blockers, expired by browsers, dropped by privacy settings - long before it reaches a report. You’re making budget decisions on a measurement that’s missing one in every three to seven visitors.

This post is an in-depth look at the marketing technology stack (the “martech stack”) as it relates to web analytics - the chain of systems your data travels through from the moment someone lands on your site to the moment a number shows up in a dashboard. We’ll walk it one layer at a time. For each layer, three questions: what is it, what goes wrong there, and what can you do about it?

We’ll use a typical Google Analytics 4 (GA4) setup as our running example, because it’s the tool most readers already know. You don’t need to be technical to follow along - where a piece of jargon is unavoidable, it gets explained in plain language the first time it appears.


The Big Picture

Before we zoom in, here’s the whole journey. Data flows left to right, from the visitor’s browser all the way out to your analytics and advertising platforms - GA4, Facebook, Google Ads, and the rest:

┌─────────┐    ┌──────────┐    ┌──────────────┐    ┌──────────────────┐    ┌────────────┐    ┌─────────────────┐
│ Browser │───▶│ Website  │───▶│ Client-Side  │───▶│  Server-Side     │───▶│ Analytics  │    │ Marketing       │
│ (User)  │    │ & Server │    │ Tag Manager  │    │  Tag Manager     │───▶│ Platforms  │    │ APIs            │
└─────────┘    └──────────┘    └──────────────┘    └──────────────────┘    └────────────┘    └─────────────────┘
                                                           │                                        ▲
                                                           └────────────────────────────────────────┘
                                                             Facebook CAPI, TikTok Events API,
                                                             Google Ads, Pinterest, Snapchat, LinkedIn…

Read that as a relay race. A visitor arrives (browser). Your website loads a small piece of code that organizes tracking. That code hands events to a tag manager running in the browser, which decides what to send where. In a more advanced setup, it passes everything to a server-side tag manager - a copy of that decision-making system running on your own server instead of inside the visitor’s browser. From there, clean data fans out to your analytics platform (GA4) and to the marketing platforms that optimize your ads.

Every arrow in that diagram is a place where data can leak. Let’s go layer by layer.


Layer 1 - The Browser

What it is: The starting point. Everything begins with a person visiting your website in a browser - Chrome, Safari, Firefox.

When the page loads, it runs little bits of JavaScript that quietly send “pings” back to analytics and advertising systems: a page was viewed, a button was clicked, a purchase happened. To remember who’s who between visits, the browser stores small text files called cookies.

The catch: the browser is the visitor’s home turf, not yours. Modern browsers actively work to limit tracking, and visitors install tools to block it. Here’s what you’re up against:

ConstraintWhat it means for your data
Safari’s tracking protection (ITP)Cookies created by JavaScript expire after just 7 days (or 24 hours if Safari decides your site is a tracker). Repeat visitors look like brand-new ones, breaking your numbers. Cookies set the server way (more on that later) are spared.
Firefox’s protection (ETP)Blocks known tracking domains outright, and blocks third-party cookies by default.
Ad blockersBlock requests to well-known tracking addresses (googletagmanager.com, google-analytics.com, facebook.net, and so on), and can strip tracking tags off your links. A large slice of users run one.
Consent requirementsLaws like GDPR require you to ask permission before setting non-essential cookies or sending tracking data. No consent, no data.

How to work around it

Most of these constraints (the browser protections and ad blockers) are tackled further down the stack - the fixes live mainly in Layers 2 and 4, where we move tracking onto your own domain and server. We’ll get there. The one constraint you can address right here, at the browser, is consent.

Consent Management Platforms (CMPs). A CMP is the tool behind the cookie banner you’ve seen everywhere (Cookiebot, OneTrust, Usercentrics). It’s the direct answer to the consent-requirement problem: it asks visitors for permission and acts as a gate, so tracking only fires when someone agrees.

Keeping some data when consent is declined. A blunt cookie banner means losing everyone who says no - but you don’t have to go completely dark. Different platforms offer a privacy-friendly fallback for declined visitors:


Layer 2 - Your Website & Web Server

What it is: Your site’s pages, the server they’re hosted on, and the first bit of tracking code baked into the page.

In a standard GA4 setup, your site’s <head> contains a small script that loads the tag manager container - usually Google Tag Manager (GTM). Think of GTM as a control panel where your team configures all your tags without touching the website’s code. Alongside it sits something called the data layer: a tidy list of facts about the page (“this is a product page,” “the cart is worth €80,” “this is a logged-in customer”) that your tags can read from.

The page essentially says: “Browser, go fetch the tag manager from Google, then let it take over.”

What goes wrong

How to work around it

The common thread to every fix below: make the tracking come from your own domain instead of Google’s. A browser treats a request to your own address the way you’d treat a letter from your own company - trusted and unblocked - versus a letter from a stranger.

Google Tag Gateway

Google’s own first-party solution. It sets up a relay so that tracking loads through a path on your domain - yoursite.com/gt/… instead of googletagmanager.com. Same setup, same tags. The important thing it changes is the context the tracking runs in: instead of pulling code from Google’s servers, everything is served from the same domain as the website itself. That makes the whole setup look far more legitimate to a browser and to ad blockers than a request off to Google, so much less of it gets blocked.

Why companies use it: Recovers visitors that would otherwise be blocked, without changing how their tags are built.

Stape Custom Loader

A feature from Stape.io that serves the tracking script under a custom, randomized filename from your own subdomain (something like data.yoursite.com/abcxyz.js). Ad blockers look for both familiar addresses and familiar filenames; this dodges both. It can even disguise the outgoing measurement data so it doesn’t look like tracking.

Why companies use it: It pushes data-collection rates about as high as they’ll go by sidestepping every common blocking trick.

Self-hosting the tag manager script

Here your own server fetches the tag manager from Google, keeps a copy, and serves it to visitors directly from your domain.

Why companies use it: Total control over how the script is delivered (you can cache it and tune it), plus a genuine privacy win - the visitor’s IP address is never handed to Google just to load the script. That matters under GDPR, though the benefit only holds if your server isn’t itself hosted on Google Cloud.

Enriching the data layer from your server

Instead of relying only on what the browser knows, your server can inject extra facts into the page as it’s built - customer value, CRM segment, order margin. This gets higher-quality data into your tracking without exposing sensitive back-office data to every script running in the browser.


Layer 3 - The Client-Side Tag Manager

What it is: A tag manager is a control panel that lets your team add, change, and remove tracking tags (the little snippets that send data to GA4, Facebook, and so on) without editing the website’s code each time. It watches for things to happen on the page - a page view, a click, a checkout - and decides which tags fire, when, and with what data. The most popular tag manager on the market by a wide margin is Google Tag Manager (GTM), and in the standard setup it runs inside the visitor’s browser.

In the default setup, each tag does its own thing right there in the browser: the GA4 tag pings Google, the Meta Pixel pings Facebook, the TikTok pixel pings TikTok, and so on. Every one of them adds its own code and makes its own network calls.

What goes wrong

How to work around it

Send less from the browser

Move as many tags as possible off the browser and onto your server. There are two ways to do this. You can rebuild the tracking logic yourself in your own backend code, which is a lot of work. Or, far more conveniently, you can switch to a server-side tag manager - the same kind of control panel, but running on a server you own instead of in the visitor’s browser. That’s the whole subject of Layer 4 below; for now, just know it’s the practical route most teams take.

Either way, the browser’s job shrinks to three steps:

  1. Collect the behavior (page views, clicks, purchases).
  2. Send one consolidated message to your server.
  3. Let the server fan it out to Facebook, TikTok, Google Ads, and the rest.

Lighter pages, far less third-party code touching your visitors’ data.

There’s a quieter benefit too: control over who sees what. In the browser, the data layer is an open book - every tag in the container can read everything in it. Once you’re collecting server-side, you can enrich events with sensitive data (customer value, segments, margins) on the server, where it’s never exposed to third-party scripts the way data-layer values are.

Use GA4 as the only messenger

A popular, clean pattern: the only tag firing in the browser is the GA4 tag. It carries the data to your server, and every other platform is fed from there. One messenger instead of a dozen.

A custom messenger

For teams that don’t want to be tied to GA4 at all, the browser can send a plain data package straight to the server, which is then built to understand it. This keeps your setup independent of any single analytics vendor.


Layer 4 - The Server-Side Tag Manager (sGTM)

This is the layer that fixes most of the problems raised above, so it’s worth covering in more detail than the rest.

What it is: A server-side tag manager is a copy of your tag manager that runs on a server you control, rather than inside the visitor’s browser. The browser sends it the raw behavior; the server then does the work of cleaning, enriching, and forwarding that data to GA4 and your ad platforms. Because the heavy lifting happens on your infrastructure, it’s invisible to ad blockers and immune to most browser restrictions.

Where it runs

You have to host it somewhere, and there are three broad routes:

The single most important fix: serve it from your own domain

By default, your server-side tag manager lives at some random-looking address that has nothing to do with your brand (like gtm-abc123.appspot.com). To browsers, that’s a stranger.

The fix is to put it on your own domain. There are two ways to do that:

Either way, the payoff is large:

This is the change that makes stable, long-lived visitor identity possible in Safari - something browser-side tracking alone simply can’t deliver.

For your technical team - Safari's IP-address check: Since Safari 16 (October 2022), pointing a subdomain at your tag-manager server isn't always enough. When the subdomain uses a direct IP record, Safari compares the IP address of the subdomain against the IP of the main site. If the first 2 blocks of the IPv4 address (the first 64 bits for IPv6) don't match, Safari assumes you're disguising a third party and caps the cookie at 7 days anyway. In practice this means a server in a totally different IP range (a separate provider) won't earn long-lived cookies in Safari. The reliable fixes are to run the tag-manager server behind the same CDN/server as the website, or on infrastructure that shares the same IP block.

More you can do at this layer

Once your data passes through a server you control, you can do things that are impossible in the browser:


Layer 5 - Analytics Platforms

What it is: The final home for your behavioral data - where reporting, analysis, and audience-building happen. For most readers that’s GA4, but it’s far from the only option. Matomo is the long-standing open-source favorite, often self-hosted; Adobe Analytics is the enterprise heavyweight; Snowplow pipes raw events into your own data warehouse; and d8a.tech is a modern take on the whole category, with a built-in reporting UI and native data-warehouse integrations so your data lands in storage you own from day one. (Whether each tool collects in the browser or on the server matters less than it used to - they all support both somehow.)

What goes wrong

The pain at this layer isn’t really about collecting the data, it’s about what owning a platform costs you:

d8a.tech is built to solve most of these at once: you keep ownership of your raw events in your own warehouse, you’re not the product, and you skip the heavy self-hosting effort - while still getting a familiar reporting interface on top.

How to get more out of it

Own the raw data

The most valuable move at this layer is getting the raw, event-by-event data into a warehouse you control. With GA4 that means turning on the BigQuery export, which ships unaggregated data into Google’s data warehouse daily and unlocks custom attribution, deeper segmentation, and joins with your other business data that the standard reports can’t do. Other platforms offer their own routes to the same end - the principle is the same: hold the raw events yourself.

Collect server-side

Every platform here supports server-side collection in some form, and routing data through your server (rather than the browser) buys you the same wins each time: no loss to ad blockers, the chance to enrich events first, and lighter pages. Same destination, far more of the data actually arrives.


Layer 6 - Marketing Platforms (Fed From Your Server)

What it is: The advertising platforms you feed conversion data to so they can optimize your campaigns - Facebook, TikTok, Google Ads, and the rest.

What goes wrong

The traditional way to feed these platforms is a browser pixel - the very same kind of tracking script that ad blockers and Apple’s iOS privacy prompts love to block. The result is undercounted conversions, which means the platforms are optimizing your budget on incomplete information. You can also end up double-counting if a conversion fires from more than one place.

How to work around it

Every major platform now offers a server-to-server connection so you can send conversions straight from your server, bypassing the browser entirely. The main ones:

Across the board, these platforms actively recommend the server-side route, for two reasons. It improves data accuracy by recovering conversions lost to ad blockers and iOS, and it lets them deduplicate events using a shared event ID - so a conversion sent from both the browser and the server is counted only once. Sensitive identifiers like email and phone are scrambled before they’re sent.


The Default Setup vs. the Improved Setup

Putting it all together. Here’s the typical setup most sites run today - note how every line is a leak:

Browser
  ├── loads gtm.js from googletagmanager.com         ← blocked by ad blockers
  ├── fires GA4 tag to google-analytics.com           ← blocked by ad blockers
  ├── fires Meta Pixel to facebook.net                ← blocked by ad blockers
  └── sets cookies via JavaScript                      ← capped by Safari to 7 days

The result: 15–40% of your data lost depending on audience. Short-lived cookies in Safari, so returning visitors look new. Every third-party script can read your page. And a slow, heavy page on top of it all.

Now the improved setup - everything routed through your own domain and your own server:

Browser
  └── loads custom-named JS from yoursite.com/somepath    ← not blocked (first-party, custom path)
        └── sends GA4 stream to yoursite.com/somepath     ← not blocked (first-party, via proxy)
              └── Server-Side Tag Manager (behind yoursite.com/somepath)
                    ├── serves the web container's JS back to the browser
                    ├── sets a stable ID cookie via the server   ← not capped by Safari
                    ├── enriches events with your own data
                    ├── sends to GA4
                    ├── sends to Facebook CAPI (data scrambled)
                    ├── sends to TikTok Events API
                    ├── sends to Google Ads Enhanced Conversions
                    └── sends to other ad platforms

The result: Near-complete data collection. A stable view of each visitor across browsers. Almost no third-party code in the page. And full control over exactly what data reaches each vendor.


Quick Reference: Every Fix in One Table

Keep this as a cheat-sheet. It maps each technique to the layer it lives on, what it does, and the main reason to bother:

LayerTechniqueWhat it doesPrimary benefit
BrowserConsent management (CMP)Gate tags on consent so tracking only fires when the visitor agreesLegal compliance
BrowserGA4 modeled data (Consent Mode v2)Send cookieless signals when consent is denied; Google estimates the restSome data instead of going dark (high traffic only, ML-estimated)
Browserd8a.tech anonymous tracking modeStitch declined-consent sessions server-side via a short-lived session stamp, no cookiesReal measured sessions at any traffic level, no user profiling
WebsiteGoogle Tag GatewayRoutes tracking through a path on your own domain (the path name can be customized)Bypasses ad blockers, first-party cookies
WebsiteStape Custom LoaderServes the tracking script under a custom filename from your own subdomain; can disguise the outgoing data tooBypasses both address- and filename-based blocking
WebsiteSelf-hosted tag-manager scriptYour server serves the container script from your own subdomainFull control, caching, ad-block bypass
WebsiteServer-side data-layer enrichmentInjects back-office data into the page before tracking loadsHigher data quality, no extra browser requests
Client tag managerTag minimizationMove all non-essential tags to the serverFaster pages, less code, better privacy
Client tag managerSingle-messenger patternOnly GA4 fires in the browser; everything else server-sideSimpler page, less vendor code
Server tag managerFirst-party domain (subdomain or /path)Serve sGTM from t.yoursite.com or yoursite.com/somepathFirst-party cookies, ad-block bypass
Server tag managerStable server-set ID (FPID)A durable cookie set by the serverSurvives Safari, longer-lived identity
Server tag managerData enrichmentAttach CRM / margin data at the serverBetter analytics, profit-based bidding
Server tag managerScramble personal dataHash emails/phones before sending to vendorsPrivacy compliance, required by the platforms
Server tag managerDe-duplicationMatch shared event IDs across browser + serverPrevents double-counted conversions
AnalyticsOwn the raw data (e.g. GA4 BigQuery export)Keep raw, event-level data in a warehouse you controlCustom analysis, cross-source joins, data ownership
AnalyticsServer-side collectionSend events from the server, not the browserNo ad-block loss, enriched data
MarketingServer-to-server conversion APIs (Facebook CAPI, TikTok Events API, Google Ads Enhanced Conversions, etc.)Send conversions from the server with scrambled identifiers and event-ID dedupRecovers iOS / ad-block signal loss, more accurate attribution

The One Idea Worth Keeping

The stack looks intimidating, but the through-line is simple: the less of your tracking that happens in the visitor’s browser, the less data you lose. That comes down to two things working together - moving the work onto a server you control, and piping the data to your vendors through your own website’s domain, so it’s far harder for ad blockers to spot and block in the first place.

Just don’t expect to set it up once and forget it. Tracking-prevention features and ad blockers keep evolving, and their detection algorithms get smarter with every release. Whatever clever workaround is winning today, the browser makers and blocker maintainers are working to catch it tomorrow. A good measurement setup is never truly “done” - it’s an ongoing cat-and-mouse game, and the setups that hold onto their data are the ones that keep adapting.

That’s exactly why it pays to build on something flexible. d8a.tech is designed to run server-side and is perfectly suited for this job - giving you a setup you can keep evolving as the rules change, while you stay in full control of your own data.

← Back to Blog