<imajery>
Resources

Google Tag Manager: Creating a Server Container

A Google Tag Manager server container allows measurement code to run separately from your website using Google Cloud infrastructure. Discover how to provision a tagging server, configure custom subdomains, and unlock superior data privacy and page speed.

A Google Tag Manager (GTM) server container allows measurement code to run separately from your website using Google Cloud’s secure infrastructure. Moving from client-side tagging to a server-side tagging environment offers three primary advantages:

  1. First-Party Context & Cookie Durability: Provides an alternative to fragile third-party cookies and protects tracking signals across browsers with strict tracking prevention (such as Safari ITP).
  2. Improved Site Performance: Heavy third-party measurement scripts run in your cloud server rather than on the user’s browser, reducing JavaScript execution time and speeding up page load speeds.
  3. Data Privacy & Governance: Client data is intercepted and sanitized before being routed to external vendor endpoints (like Meta, TikTok, or Google), preventing sensitive user details from leaking.

Follow this step-by-step tutorial to create a server container, configure Google Cloud billing, and attach a custom subdomain.


1. Create a Tag Manager Server Container

To use server-side tagging, start by setting up a dedicated container within your Google Tag Manager account:

  1. Navigate to tagmanager.google.com and sign in with your Google account.
  2. Click the three vertical dots (⋮) next to your account name and choose Create Container.
  3. Under Container name, enter a descriptive title (e.g., www.yourwebsite.com - Server Container).
  4. Under Target platform, select Server.
  5. Click Create.
Create a Server Container in Google Tag Manager
  1. An Install Google Tag Manager prompt will appear. Click Automatically provision your tagging server.
  2. In the Create tagging server dialog, select your Google Cloud billing account and click Select billing account and create server. (If you do not have a billing account configured yet, see the next section below).
  3. Wait for the “Stand by while your server is created” progress bar to finish.
  4. On the Server Created screen, click Close.

2. Creating a Google Cloud Billing Account

A tagging server typically falls under the free tier of Google Cloud services unless your organization already runs other cloud workloads or your website handles very high traffic volumes.

  1. In the provisioning dialogue, click Create a billing account.
  2. In the Name field, enter an identifiable label (such as "TD Visa" or "Company Corporate Card").
  3. Select the correct Country to ensure billing in your preferred local currency.
  4. Click Continue.
Creating a Google Cloud Billing Account
  1. Complete the Set up your billing profile page with your business payment details and click Submit and enable billing.
  2. Return to tagmanager.google.com.
  3. Click ⋮ next to your server container and select Container Settings.
  4. Click Set up your tagging server, select Automatically provision your tagging server, and attach your newly created billing profile.
Attaching Google Cloud Billing Account to GTM Server Container

3. Add a Custom Domain to the Server Container

Because ad blockers and privacy extensions frequently flag default Google Cloud App Engine URLs, routing measurement through a custom subdomain (e.g., metrics.yourdomain.com) ensures seamless first-party data flow.

  1. Navigate to the Google Cloud Console.
  2. Select your server container project from the top dropdown menu.
Google Cloud Project Selection
  1. Click the navigation hamburger menu in the upper-left corner and navigate to More Products → App Engine → Settings.
Google Cloud App Engine Settings Menu
  1. Switch to the Custom Domains tab and click Add a custom domain.
  2. Select your root domain from the dropdown. (If your domain is not listed, see the Verify a New Domain section below).
  3. Enter your chosen custom subdomain for the tagging server (e.g., metrics.yourdomain.com) and click Save Mappings.
Add Custom Domain to App Engine
  1. Once saved, click Continue. Copy the provided DNS records (typically CNAME or A/AAAA records) and add them to your domain’s DNS provider (Cloudflare, GoDaddy, Route53, etc.).
  2. Click Done. Google will provision a free managed SSL certificate within 15–60 minutes.
  3. Return to Google Tag Manager, click ⋮ next to your server container, and choose Container Settings.
Opening Container Settings in Google Tag Manager
  1. Under Server Container URLs, click Add URL, enter your full secure subdomain URL (e.g., https://metrics.yourdomain.com), and click Save.
Saving Custom Server Container URL in GTM

4. Verify a New Domain (If Not in Google Cloud)

If your root domain has not yet been verified in your Google Cloud account:

  1. Select Verify a new domain from the domain dropdown menu.
  2. Enter your root web domain and click Verify.
  3. In the new window, complete site ownership verification via DNS TXT record or HTML file as outlined in Google’s Site Ownership Guide.
  4. Return to your Google Cloud App Engine tab and finish adding your custom subdomain.

For deeper technical specifications, refer to Google’s official server-side Tag Manager documentation.

Looking to implement server-side tracking, GA4 measurement, or custom Conversion APIs without breaking your live tracking? Explore our data analytics and tracking services or claim a free measurement audit with our engineering team today.

Key Takeaways

  • Server-side tagging moves heavy third-party tracking scripts off the visitor's browser, improving website performance
  • Protect customer privacy by filtering, cleaning, and validating sensitive data before sending it to vendor endpoints
  • Provision a tagging server directly on Google Cloud Platform with automated single-click deployment
  • Map a first-party custom subdomain (e.g., metrics.yourdomain.com) to bypass browser tracking blockers and ad blockers
  • Verify DNS records and obtain an automatic Google Cloud SSL certificate for secure end-to-end telemetry

Need Professional Guidance on Server-Side Tagging & Tracking Architecture?

<imajery> designs resilient, privacy-compliant tracking environments for high-growth e-commerce and lead gen companies. We configure server-side containers, Conversions API (CAPI), and GA4 measurement to ensure zero data leakage.

Jay Sala

Jay Sala

Founder

Jay is the founder of <imajery>, leading digital marketing innovation, technical web infrastructure, and strategic paid acquisition across global brands.