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.
| Stage | What changes | How you know it held |
|---|---|---|
| 1. Baseline | Nothing; a week of numbers recorded | Orders, GA4, Ads and Meta per day, filed |
| 2. Build | Server, domain, test GA4 property | Server Preview shows hits arriving |
| 3. Parallel run | A copy of GA4 data goes to the test property | Test property tracks live within 2% a day |
| 4. Scripts on your domain | gtm.js loads from your server | Your domain is the source; baseline holds a day |
| 5. Cut over, one platform at a time | GA4, then Google Ads, then Meta | Baseline holds after each publish |
| 6. Cookie | GA4 cookie set by the server | Safari 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:
- Add a second Google tag with the test property’s ID, and
server_container_urlset to the server’s address (older guides usetransport_url). - 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 day | Pass | If it fails, look at |
|---|---|---|
| Purchases, test vs live | Within 2% | Pages without the tag; CSP block; trigger |
| Revenue, test vs live | Within 2% | value or currency lost on the way |
| Both vs store orders | Your usual gap, unchanged | Something new, not the server |
| One purchase in DebugView | All parameters present | Server 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:
- 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). - If the site has a Content Security Policy and the server sits on a subdomain, add it to
script-srcfirst (same origin is covered by'self'). Otherwise the next step blocks GTM itself, and no tag fires anywhere. - Change the GTM snippet in the site code so it loads
gtm.jsfrom your server’s address and that path. Don’t add the serving path toserver_container_url; Google’s guide keeps them separate. - Check DevTools › Sources: your domain should be listed as the source of
gtm.js. If it still showswww.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.
- In one web container version, add
server_container_urlto the live Google tag and remove the test Google tag and test event tags. - 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.
- 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. - Check the GA4 purchase carries
transaction_id,valueandcurrency. The server tag reads them from there; missing there means missing in Ads. - Using enhanced conversions? The web Google tag must send
user_data. Check it in server Preview before the publish. - 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.
- 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. - Server publish second: add a Conversions API tag (a template from the gallery) and map that parameter to its event ID field.
- 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.
Stage 6: when do you switch the GA4 cookie to the server?
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:
- Google for Developers, configuring the Google Analytics data stream with server-side tagging (new GA4 property for server data, dual-tagging, switch once server matches client; GA4 client on JavaScript Managed until domain settings change; trigger on Client Name;
server_container_url; Preview check) - Google for Developers, send data to server-side Tag Manager (a client must claim each request; GA4 client installed by default; CSP
img-src,connect-src,frame-src) - Google for Developers, custom domain configuration (same origin as best practice, subdomain, default domain only JavaScript cookies)
- Google for Developers, Google tag gateway: load Google scripts first-party (serve
gtm.jsthrough a CDN or tagging server; Web Container client and tag serving path; DevTools Sources check) and Google tag gateway with CDN and sGTM (same origin, separate paths for scripts and collection) - Google for Developers, Google Ads conversions with server-side tagging (Conversion Linker, Google Ads Conversion Tracking tag,
user_data, remove web tags to avoid duplication) - Google for Developers, consent mode with server-side Tag Manager (Google’s server tags are consent-aware)
- Google Analytics Help, tagging best practices (Server Managed client ID, over-time migration, all measurement through the server, no parallel standalone client-side implementation)
- Google Ads Help, transaction IDs to avoid duplicate conversions (duplicate with the same ID not counted; system
GG_IDs treated as blank) - Meta for Developers, deduplicate Pixel and server events (event name and event ID, 48 hours)
- WebKit, tracking prevention in WebKit (CNAME and third-party IP address cloaking: cookies set in the HTTP response capped at 7 days)