How to Set Up Server-Side Tracking with Google Tag Manager in 2025
Server-side Google Tag Manager (sGTM) is the most important tracking infrastructure upgrade you can make in 2025. It solves three critical problems simultaneously: tracking accuracy, page load speed, and privacy compliance.
Here's how to set it up and why it matters.
Why Server-Side GTM
Traditional client-side GTM loads tracking scripts in the user's browser. This creates three problems:
- Ad blockers block the scripts — 25-30% of users have ad blockers installed
- Scripts slow down your page — each tracking pixel adds 100-500ms of load time
- Privacy regulations restrict client-side data collection — GDPR, CCPA, and browser policies are all tightening
Server-side GTM moves the processing to your own server. The user's browser sends data to YOUR server, which then processes and forwards it to Google, Facebook, and other platforms. The user never sees (or blocks) the tracking scripts.
The Setup (Overview)
Step 1: Create a Server Container in GTM
In your GTM account, create a new Server container. This is separate from your existing Web container. Google will give you a container config that you'll deploy to a server.
Step 2: Deploy the Server
Google offers one-click deployment to Google Cloud Run (recommended for most businesses). Cost: $20-50/month for typical traffic volumes. Alternatives: AWS, Cloudflare Workers, or Stape.io for managed hosting.
Step 3: Configure Your Custom Domain
Point a first-party subdomain (like track.yourdomain.com) to your server container. This is critical — first-party domains aren't blocked by ad blockers and aren't subject to third-party cookie restrictions.
Step 4: Set Up the GA4 Client
The server container receives hits from your website and processes them. The GA4 client handles incoming measurement protocol data and makes it available to your server-side tags.
Step 5: Add Server-Side Tags
Create server-side tags for each platform you track:
- Google Analytics 4
- Facebook Conversions API
- Google Ads conversion tracking
- Any other platforms (LinkedIn, TikTok, etc.)
Step 6: Update Your Web Container
Modify your existing web GTM to send data to your server container URL instead of directly to Google/Facebook. This is the “transport” change — data flows from browser to your server to the platforms.
The Results You'll See
- 10-30% more conversions tracked (recovered from ad blocker users)
- 1-3 second improvement in page load time (fewer client-side scripts)
- Better data quality (server-side enrichment and validation)
- Privacy compliance (you control exactly what data gets sent where)
- Improved ad platform optimization (more accurate conversion signals = better algorithm performance)
Related Reading
Related Content
- Google Tag Manager Triggers: What Are They & How Do You Create Them?
- How To Set Up A Facebook Pixel Using Google Tag Manager
- How To Season Your Facebook Pixel To Give You The Best Leads
- What is Facebook Pixel Seasoning And Why Is It Important?
Ready to Transform Your Marketing?
Let's talk about AI-powered advertising, lead generation, or building your own agentic business system.
