Rejoice Software logo

Analytics · · 4 min read

Server-side GTM + GA4 + Conversion APIs: a 2026 setup guide

iOS 17+, ITP, Consent Mode v2, and the practical way to keep marketing data flowing without violating privacy law.

Why tracking broke

Browser-based tracking has become less reliable every year. Safari’s Intelligent Tracking Prevention shortens the life of cookies set by JavaScript, and Apple’s Link Tracking Protection removes known tracking parameters from links in Mail, Messages and private browsing. Ad blockers stop many third-party scripts entirely. On top of that, privacy laws in Europe and elsewhere require consent before most marketing tracking.

The result is missing conversions, weaker ad optimisation and reports nobody trusts. Server-side tagging does not bring back data people did not consent to share, but it recovers much of what is lost to technical limits.

How server-side tagging works

Your website still has a Google Tag Manager web container, but instead of sending data directly to Google, Meta and others, it sends events to a server container running on your own subdomain, such as data.yoursite.com. That server then forwards the events to GA4, Google Ads, Meta’s Conversions API, TikTok’s Events API and any other destination.

Because the endpoint is first-party, cookies can be set by the server with longer, more reliable lifetimes, and fewer requests are blocked. You also get a single place to remove or hash personal data before it leaves your infrastructure.

Consent Mode v2 comes first

Since March 2024, Google requires Consent Mode v2 signals for advertising features for users in the European Economic Area. Besides analytics_storage and ad_storage, two newer parameters describe whether user data may be sent to Google for advertising (ad_user_data) and whether it may be used for personalised ads (ad_personalization).

Set default consent to denied before any tag loads, update it when the visitor chooses in your cookie banner, and make sure the server container respects the same state. Server-side tagging must never be used to send data that the visitor declined.

gtag('consent', 'default', {
  ad_storage: 'denied',
  ad_user_data: 'denied',
  ad_personalization: 'denied',
  analytics_storage: 'denied',
  wait_for_update: 500
});

A setup that works

  • Create a server container in Google Tag Manager and host it on Cloud Run or a managed tagging host.
  • Map a subdomain of your site to it, so requests are first-party.
  • Point the GA4 tag in the web container to the server container URL.
  • In the server container, add the GA4 client and tags for GA4, Google Ads conversions and enhanced conversions.
  • Add Meta’s Conversions API and other platforms as server tags, forwarding consent, IP address and user agent where allowed.
  • Generate an event_id in the browser for each conversion, send it with both the pixel and the server event, and let the platform remove duplicates.
  • Hash email addresses and phone numbers with SHA-256 before sending them for enhanced matching, and only with consent.

Common mistakes

  • Counting conversions twice because browser and server events do not share an event_id.
  • Forgetting consent parameters on server-side requests, so platforms treat all traffic the same.
  • Running the server container on a single small instance; plan for enough capacity and monitor errors.
  • Switching off the old tags on launch day instead of comparing both setups side by side first.

Testing and rollout

Use the preview mode of both containers and GA4’s DebugView to watch events flow end to end. Check Meta’s Events Manager for deduplication and match quality. Then run old and new tracking in parallel for one or two weeks, compare conversions per channel, and only switch fully when the numbers make sense.

Done carefully, server-side tagging gives you more complete data, faster pages (fewer third-party scripts in the browser) and better control over privacy — all at the same time.

Want us to look at your site?

Run the free website checker for an instant report, or create a ticket and an engineer will reply within one working day.

#GTM #GA4 #CAPI #Consent

Let's talk

Let's build something worth talking about.

Free 30-minute strategy call. No pitch, no obligation — just a plan.

Start a project