This guide explains how to connect Google Analytics 4 (GA4) with a Server-Side Google Tag Manager container. The setup allows analytics data to be sent through your own tracking server before being forwarded to Google Analytics.
Requirements
- A website with a Web Google Tag Manager container installed
- A deployed Server-Side GTM container
- A tracking subdomain (example: tracking.yourdomain.com)
- A Google Analytics 4 property
Step 1 — Create a GA4 Property
- Open Google Analytics
- Go to Admin
- Select Create Property
- Choose Google Analytics 4
- Copy the Measurement ID
Step 2 — Configure the Web GTM Container
- Open your Web Google Tag Manager container
- Click Tags → New
- Select Google Analytics: GA4 Configuration
- Enter the Measurement ID
- Set Transport URL to your server container domain
https://tracking.yourdomain.com
Step 3 — Set the Trigger
Select:
All Pages
Click Submit → Publish.
Step 4 — Configure the Server Container
- Open the Server GTM container
- Go to Clients
- Verify that the GA4 Client is enabled
Step 5 — Create the Server Tag
- Click Tags → New
- Select Google Analytics: GA4
- Enter your Measurement ID
Step 6 — Trigger
Client Name equals GA4
Step 7 — Publish
Click Submit → Publish.
Step 8 — Test the Setup
- Open GTM Preview mode
- Visit your website
- Check the Server container debugger
- Verify events appear in GA4 Realtime reports
Your Google Analytics 4 tracking is now running through Server-Side Google Tag Manager.