Stape

How to easily add user agent and geo data to server Google Tag Manager

Updated
Apr 19, 2024
Published
May 16, 2023
Also available in

Stape offers many solutions and power-ups to simplify and improve server-side tagging possibilities. In this article, we want to discuss User Agent Info and GEO Headers power-ups. Keep reading to understand how this power-up works and can be used inside your server Google Tag Manager container.

user agent and geo-header power-ups from stape

User Agent Info power-up explainedCopy link to this section

User Agent Info power-up allows you to add information about the browser and device to incoming requests of your server Google Tag Manager container. You can easily extract data from headers and use it in any of your sGTM tags. 

When User Agent power-up is enabled inside your server, Google Tag Manager container, 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

GEO Headers power-up explainedCopy link to this section

When GEO header power-up is enabled, the following headers are added to sGTM requests:

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

By activating the GEO Headers power-up, you gain valuable information about the location of your website visitors. With the help of this data, you can modify tag delivery based on the user's country, region, or city. For example, ask user consent based on the country where a user is located or build remarketing audience depending on their territory. 

Use caseCopy link to this section

If you check Event Data on hits claimed by GA4 Client - the geo/user_agent data will not be mapped to Event Data. However, you can use sGTM native “Request Header’ variables to reach those data points.

Event Data is a layer populated by whichever Client (see sGTM->Clients) has claimed your request. Since GA4 Client is a proprietary, native tool - it does not map those custom headers into Event Data. However, you can check the presence of those headers by checking the Incoming HTTP Request in the Request tab of your sGTM preview. To utilize this data, you need to use the ‘Request Header’ variable in your sGTM, which works exactly the way the Event Data variable does, only references different things.

request header variable
incoming http request

ConclusionCopy link to this section

User Agent Info and GEO Headers power-ups help to quickly access device, browser, or geographical information from sGTM headers and use this data in server tags.

If you have any questions about User Agent Info or GEO Headers power-ups, or any other issue, don’t hesitate to contact Stape support.

Need help setting up server-side tracking?

We've got you covered! Click Get assistance, fill-up the form, and we will send you a quote.

Get assistance
Tagged with:gtm server

Host your GTM server at Stape