How to Easily Add User Agent and Geo Data to Server Google Tag Manager Using Stape Power Up

Server-side Google Tag Manager (sGTM) gives you more control over how data is processed and forwarded to analytics and advertising platforms. But sometimes, valuable information about the user’s device or location is not readily available inside your server container.

If you want quick access to browser, device, and geographic data without writing custom parsing logic, Stape offers two simple solutions:

  • User Agent Info power-up
  • GEO Headers power-up

In this guide, you’ll learn what these power-ups do, how they work, and how to use them inside your sGTM container.

Why Add User Agent and Geo Data in sGTM?

By default, some user environment details are not mapped directly into Event Data in server-side GTM — especially when requests are claimed by native clients like Google Analytics 4 Client.

This means:

  • Browser information may not be easily accessible.
  • Device details may not appear in Event Data.
  • Geo information might not be directly usable inside tags.

The solution? Enrich your incoming requests with structured headers that you can easily access.

User Agent Info Power-Up 

The User Agent Info power-up extracts browser and device information from incoming requests and adds them as structured headers in your sGTM container.

Once enabled, the following headers are added:

  • X-Device-Mobile
  • X-Device-Os
  • X-Device-Browser
  • X-Device-Browser-Version
  • X-Device-Engine
  • X-Device-Engine-Version
  • X-Device-Model
  • X-Device-Platform

This allows you to:

  • Identify mobile vs desktop users
  • Detect operating systems
  • Segment by browser type
  • Customize tag behavior based on device

For example, you can:

  • Send specific tags only for mobile users
  • Adjust remarketing logic based on device
  • Troubleshoot browser-specific tracking issues

All without manually parsing user-agent strings.

GEO Headers Power-Up Explained

The GEO Headers power-up adds geographic information to each incoming sGTM request.

When enabled, the following headers are added:

  • X-GEO-Country
  • X-GEO-Region
  • X-GEO-City
  • X-GEO-Ipaddress
  • X-GEO-PostalCode

This product includes GeoLite2 data created by MaxMind.

With GEO Headers enabled, you can:

  • Deliver tags based on user country
  • Trigger consent logic depending on region
  • Build geo-based remarketing audiences
  • Customize tracking based on location

For example:

  • Show GDPR consent logic only for EU countries.
  • Adjust campaign tracking rules by region.
  • Send region-specific conversion data.

Important: Why You Don’t See This in Event Data

If you check the Event Data section in sGTM preview (especially for GA4 Client requests), you may not see geo or user-agent data mapped there.

That’s because:

  • Event Data is populated by whichever Client claims the request.
  • The GA4 Client does not automatically map custom headers into Event Data.

However, the data is still available.

You can access it using the Request Header variable in server GTM.

How to Access User Agent and GEO Data in sGTM

To use the data inside your tags:

  1. Go to Variables in sGTM.
  2. Create a new variable.
  3. Choose Request Header as the variable type.
  4. Enter the header name (e.g., X-GEO-Country or X-Device-Browser).

This works similarly to Event Data variables — but it pulls values from request headers instead.

You can then:

  • Use the variable in triggers
  • Add it to tag payloads
  • Modify tag delivery conditions

Practical Use Cases

Here are a few real-world applications:

1. Country-Based Consent Logic

Use X-GEO-Country to trigger GDPR consent only for users located in EU countries.

2. Device-Specific Tag Delivery

Use X-Device-Mobile to fire mobile-only tags.

3. Geo-Based Audience Segmentation

Pass city or region data to GA4 for localized remarketing.

4. Browser Debugging

Use X-Device-Browser-Version to troubleshoot tracking discrepancies across browser versions.

How to Enable These Power-Ups

To activate either power-up:

  1. Log in to your Stape account.
  2. Open your server container.
  3. Go to Power-Ups.
  4. Click Use next to:
    • User Agent Info, or
    • GEO Headers.
  5. Toggle it ON.
  6. Click Save changes.

Once enabled, the headers are automatically added to incoming sGTM requests.

Final Thoughts

Accessing device and geo information inside server-side GTM doesn’t have to require complex custom logic.

With Stape’s:

  • User Agent Info power-up
  • GEO Headers power-up

you can instantly enrich your sGTM requests with structured, ready-to-use data.

This allows you to:

  • Improve targeting precision
  • Enhance consent management logic
  • Build better audiences
  • Gain deeper insights