TRACKING SPECIALIST — BARIS ASA · LONDON
Synctag
Start the check → TRACKING SPECIALIST — BARIS ASA · LONDON

READING ROOM › FIELD NOTE › NOTE-029

NOTE-029 · FIELD NOTE FILED 12 NOV 2026 · REVISED 12 NOV 2026 F-401 F-101 F-102 F-201

Moving from client-side GTM to server-side GTM: a migration plan that checks for gaps and double counts.

ABSTRACT — To move to server-side GTM without losing data, build the server beside the live setup, send a copy to a test GA4 property until it agrees with the live one within 2% a day (my pass mark), with the gap to your orders unchanged, then move GA4, Google Ads and Meta one at a time, with a fixed publish order for each so nothing is lost or counted twice. Switch the GA4 cookie last.

Baris Asa, Synctag, tracking specialist, London · Last checked: November 2026

To migrate from client-side to server-side GTM without losing data, run both side by side first. Build the server beside the live setup and send a copy to a test GA4 property until it tracks the live one within 2% a day (my pass mark; Google’s condition is that they match). Then move GA4, Google Ads and Meta one at a time, in a fixed publish order per platform, so nothing goes missing or counts twice. Switch the GA4 cookie to server-set last.

A migration loses data in two ways. A gap: a platform drops towards zero while orders carry on. A double count: GA4 or Ads purchases climb above store orders the day after a publish. Both surface later, in bidding and in reports, so every stage below has a check that proves it held before the next one starts.

End to end that is about three to four weeks: a week of baseline, at least a week in parallel, a few days for the three cut-overs, then the cookie switch, watched over the weeks after. Those timings are mine.

Not building it yourself? Three things are yours:

  • Your numbers: a week of daily orders from your store or CRM, filed before anything changes.
  • Your dates: no cut-over before peak trading.
  • Your sign-off: the day after each change, that platform’s purchases against store orders. Towards zero is a gap, above orders is a double count, and either one means the previous version goes back live.

The server also has a monthly hosting bill; what drives it is in the hosting note.

This note is the how. Whether you need server-side at all is answered in server-side vs web GTM and, for smaller stores, is server-side tracking worth it. Where to host it is in server-side GTM hosting. The decisions to write down before Stage 1, from which platforms move to who maintains the server, are in the server-side chapter of the field manual.

What does the migration plan look like?

Six stages. The web container stays on the site throughout: server-side GTM (sGTM) receives what the browser sends, it doesn’t replace the browser container.

StageWhat changesHow you know it held
1. BaselineNothing; a week of numbers recordedOrders, GA4, Ads and Meta per day, filed
2. BuildServer, domain, test GA4 propertyServer Preview shows hits arriving
3. Parallel runA copy of GA4 data goes to the test propertyTest property tracks live within 2% a day
4. Scripts on your domaingtm.js loads from your serverYour domain is the source; baseline holds a day
5. Cut over, one platform at a timeGA4, then Google Ads, then MetaBaseline holds after each publish
6. CookieGA4 cookie set by the serverSafari share of new users, week on week

Whoever builds it needs Publish access to both containers, access to the hosting (a Google Cloud project or a managed host’s account), someone who can add a DNS record for your domain, and a test order or test form after each change.

Stage 1: what do you record before touching anything?

A week of the numbers the business already relies on, per day:

  • paid orders (or CRM leads) from the store or CRM itself
  • GA4 purchases or key events, and revenue
  • Google Ads conversions, by conversion action
  • Meta events received, from Events Manager

Then export the live web container (Admin › Export Container) and file it with the date. Every later stage is compared with this week. Without it, “the migration went fine” is a guess.

Stage 2: what gets built first?

The server and its address, with nothing live pointing at it yet.

  • The tagging server. On Cloud Run or a managed host. That choice, and who looks after it, is in the hosting note.
  • A custom domain. Google lists three options. Same origin (yourshop.co.uk/metrics, through your CDN or load balancer) is best practice. A subdomain (data.yourshop.co.uk) is the simpler alternative. The default domain can only set JavaScript cookies. Pick with Stage 6 in mind. Same origin means tracking runs under your own domain’s path and needs your developer or CDN set-up. A subdomain is quicker. If it CNAMEs to, or resolves to an IP outside, your site’s own infrastructure, Safari caps the server-set cookie at 7 days once you reach Stage 6.
  • A test GA4 property. Used only for the parallel run, so the live property never receives a copy.
  • GA4 client (often called the data client). The part of the server container that accepts incoming GA4 hits; Google installs it by default. Set its cookie setting to JavaScript Managed for now, and check it rather than relying on the default: the browser keeps setting the GA4 cookie, as today.
  • GA4 tag with default fields. Google’s setup course leaves them at their defaults, so the tag inherits the measurement ID and parameters from each hit. Test hits land in the test property; later, live hits land in the live one.

If the site has a Content Security Policy (a header listing which addresses the page may talk to), add the server’s address to img-src, connect-src and frame-src, Google’s list for measurement. Leave it out and every hit is blocked, with the error shown only in the browser console. Stage 4 adds one more.

Stage 3: how do you run server-side GTM in parallel (dual-tagging) before switching?

Google’s server-side course calls it dual-tagging: you duplicate your existing tagging so the same events reach two properties. The live tags keep sending to the live property as before. In the web container:

  1. Add a second Google tag with the test property’s ID, and server_container_url set to the server’s address (older guides use transport_url).
  2. Duplicate each GA4 event tag you rely on, at least purchase and your key events, so it also sends to the test ID. A Google tag on its own sends page views and GA4’s automatic and enhanced measurement events, not your purchase or key events.

The server receives those copies and, inheriting the test ID, forwards them to the test property.

The copy goes to a different property, so nothing the business reports on changes. Compare the two properties, and both with your orders, for at least one full trading week:

Check, per dayPassIf it fails, look at
Purchases, test vs liveWithin 2%Pages without the tag; CSP block; trigger
Revenue, test vs liveWithin 2%value or currency lost on the way
Both vs store ordersYour usual gap, unchangedSomething new, not the server
One purchase in DebugViewAll parameters presentServer GA4 tag mapping

The test property should track the live one, not beat it. At this stage gtm.js still loads from Google, so a browser that blocks it sends nothing to either. Clearly more than live usually means a test event tag is firing twice.

Lower than live? Something isn’t reaching the server. One common cause: the built-in All Pages trigger covers page views only, so Google’s course puts the server-side GA4 tag on a trigger that matches the client’s name instead.

DebugView is GA4’s live event view. Open one test purchase there and check that transaction_id, value, currency and items arrive as the live tag sends them.

Consent. Place one test order with the banner declined and one accepted. With Consent Mode in advanced mode, the declined visit should still send Google’s cookieless pings, and those feed modelled conversions, so check they reach the server rather than vanish. Google’s server tags follow the consent state that arrives with each hit; Google’s page says nothing about other vendors. In my builds, Meta’s and the rest get the template’s consent setting or a consent condition on their trigger. How to set that up and prove it is in Consent Mode v2 with server-side GTM, F-201 .

Stage 4: why doesn’t the GA4 client on its own stop ad blockers?

Routing GA4 through the server’s GA4 client (the data client) doesn’t stop ad blockers on its own, because gtm.js or gtag.js still loads from www.googletagmanager.com. Block that file and no tag runs, so nothing reaches your server either.

The fix: serve the script from your own domain. Google calls this Google tag gateway, through a CDN or your tagging server. Before you start, check the server’s health and minimum instances: from this stage every browser tag loads through it, so if the server is down, GA4, Google Ads and Meta all lose data at once. The snippet edit is a site change, so nothing else changes that week. Through the tagging server:

  1. In the server container, add a Google Tag Manager: Web Container client for your container ID, with a tag serving path (a path starting with a slash, such as /scripts; GTM suggests a random one).
  2. If the site has a Content Security Policy and the server sits on a subdomain, add it to script-src first (same origin is covered by 'self'). Otherwise the next step blocks GTM itself, and no tag fires anywhere.
  3. Change the GTM snippet in the site code so it loads gtm.js from your server’s address and that path. Don’t add the serving path to server_container_url; Google’s guide keeps them separate.
  4. Check DevTools › Sources: your domain should be listed as the source of gtm.js. If it still shows www.googletagmanager.com, the script is still coming from Google.

Then test with a blocker: install a common ad blocker in Chrome, place a test order and watch the test property’s Realtime report. In DevTools › Network, filter for collect: those requests should go to your server’s address, not google-analytics.com. Blockers can still match a first-party address, so treat this as a partial recovery, measured by this test, not a guarantee. That gap is filed as F-401 . Check the baseline holds for a day after the snippet change. From here the test property can legitimately beat live, for visitors whose blockers stopped Google’s own addresses, so the Stage 3 parity rule no longer applies.

Serving the script from your domain doesn’t make Safari keep cookies longer. That is Stage 6, and the difference is filed in Tag Gateway doesn’t fix Safari ITP.

Stage 5: how do you cut over each platform?

One platform at a time, each as a named version (“sGTM 1: GA4 live via server”). Not everything moves. Tags that need the page itself (heatmaps, session recording, chat, A/B testing) and platforms without a server template you trust stay in the web container, loading as they do now. Where a platform needs both containers, the order of the two publishes matters, so it is spelled out below. After each platform, wait at least a day and check the baseline before the next.

GA4.

  1. In one web container version, add server_container_url to the live Google tag and remove the test Google tag and test event tags.
  2. Nothing changes in the server container: its GA4 tag inherits the live ID from the hits that now arrive.

Because the cut-over is a single web publish, rolling it back is too. Google’s tagging best practices say not to keep a server-side and a standalone client-side implementation for the same property side by side. That is how purchases double, F-101 .

Google Ads.

  1. In the server container, add a Conversion Linker tag (it stores the ad click ID; Google suggests the All Pages trigger) and a Google Ads Conversion Tracking tag with the same conversion ID and label as the browser tag. Trigger it on a custom event whose name matches your GA4 event tag’s event name (usually purchase), never on the client name, which would fire it on every page view. One server tag per conversion action.
  2. Check the GA4 purchase carries transaction_id, value and currency. The server tag reads them from there; missing there means missing in Ads.
  3. Using enhanced conversions? The web Google tag must send user_data. Check it in server Preview before the publish.
  4. Publish the server container first, then remove the browser’s Google Ads conversion tag in a web publish straight after. Google’s server-side guide says to remove it to avoid duplication. To roll back, pause the server tag first, then restore the browser tag.

In the minutes between the two publishes, both tags send. Google Ads drops a second conversion with the same transaction ID in the same conversion action, so a real transaction_id keeps that window clean. Without one, Google treats its system GG_ IDs as blank, so both the browser and the server conversion are counted.

Meta.

  1. Web publish first: create one event ID per event in the dataLayer, pass it to the Pixel as eventID, and to the GA4 event as a parameter. The Pixel stays in the browser. On its own this changes nothing Meta counts.
  2. Server publish second: add a Conversions API tag (a template from the gallery) and map that parameter to its event ID field.
  3. Check Events Manager shows browser and server events deduplicated.

The other way round, the server sends purchases before the Pixel carries the ID, and each one arrives twice.

Meta deduplicates on event name and event ID, within 48 hours of the first event. If the IDs differ, every purchase arrives twice, F-102 . The check is in Meta CAPI deduplication: check event_id matches.

Test each cut-over with Preview open on both containers: web Preview shows the hit leaving, server Preview shows which client claimed it and which tags fired. When something doesn’t arrive, the order to check is in server-side GTM errors.

This is the step that helps returning Safari visitors be recognised for longer, so fewer of them are counted as new.

When: last, and only once every GA4 hit for the stream goes through the server. Google’s best-practice page is strict: with Server Managed on, all measurement for the stream must flow through the server tag, and none can go directly to Google. It also offers an over-time migration option for sites with existing traffic, so returning visitors aren’t counted as new on the day of the switch.

What it changes: with Server Managed (the server, not the browser, sets the GA4 cookie), the server keeps its own client ID and writes the cookie in its response. Google’s domain guide rates both same origin and a subdomain as getting the durability benefit. WebKit caps cookies set in a server’s response at 7 days when it detects third-party CNAME or IP address cloaking. In my reading of WebKit’s rules, which Google’s page doesn’t address, a subdomain that CNAMEs to, or resolves to an IP outside, your site’s own infrastructure is the risky case, and same origin through your own CDN or load balancer is the safe one.

What to check: in GA4’s Tech details report, compare the share of new users in Safari and Chrome over the following weeks. It is a signal, not proof.

When should the switch not happen?

  • Not before peak trading. Black Friday week, a sale, a big launch: the parallel run can go on, the cut-over waits.
  • Not in the same week as a site change. If the developer changes the dataLayer while you move tags, a gap can’t be traced to either.
  • Not with the browser tag left in “for safety”. That is the double count, in GA4, Google Ads or Meta.
  • Not without a rollback written down for that stage. The steps per platform are in the rollback question below.

Who should run the migration?

An in-house developer with GTM experience can follow this plan. Bring someone in when the server will feed bidding and nobody wants to own the cut-over, when nobody will watch the server after launch, or when an agency needs the work done in a client’s accounts under its own name.

I’m a tracking specialist in London and do this as server-side tracking work for UK ecommerce brands and the agencies behind them. I build in your own GTM account and cloud project, so you keep it. No partnership or commission with any host. You get back, on record:

  • the Stage 1 baseline
  • the Stage 3 comparison against orders
  • a named version for each cut-over, with a note of what changed

To start, send the web container export and a week of store orders next to GA4 purchases. Scope and timing are agreed on a short call once I’ve seen both setups. For GTM work beyond the server, see Google Tag Manager consultant.

Common questions

How long should the server run in parallel before the switch?

At least one full trading week, so weekdays and the weekend both pass, and longer if a sale or campaign launch falls inside it. Google’s own condition is that you switch only once the server-side numbers match the browser ones.

Can I move only Meta to the server first?

Yes, if the events reach the server. The Conversions API tag in the server container reads the GA4 hits that arrive, so either route the live GA4 tag through the server first, or keep a separate GA4 event tag with server_container_url and the test property’s ID for the Meta events after the test tags go. With the live ID, the server would forward those hits to the live property as well and GA4 would double. The Pixel stays in the browser, and Meta deduplicates the two on event name and event ID.

Will GA4 treat everyone as a new user after the switch?

Not while the GA4 client stays on JavaScript Managed, where the browser keeps setting the GA4 cookie as it does now. Visitors keep the ID they already have. Moving to Server Managed is a separate, later step, and Google offers an over-time migration option for sites with existing traffic.

What is the rollback if the numbers drop after a cut-over?

GA4: publish the previous web container version; the server needs no change. Google Ads and Meta: pause the server tag first, then publish the previous web version. If the site snippet was changed to load GTM from your server, revert that in the site code as well. After the cookie switch, set the GA4 client back to JavaScript Managed first, and expect a break in client IDs.

Sources

Read on 12 November 2026:

— B.A., filed from London

CONNECTED RECORDS F-401 F-101 F-102 F-201

REVISION HISTORY — revised 12 NOV 2026.

← back to the reading room