> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/optimize-your-setup/geo-headers.md).

# GEO headers

Use the location data (country, region, city, IP address and postal code) that AdPage automatically adds to every incoming request in your GTM server container.

### What are GEO headers?

Need better location information for advanced server-side logic? Use the GEO headers. AdPage server-side tagging automatically adds geographic information about the visitor as headers to every incoming request. This lets you identify where a visitor is accessing your site from, without relying on separate APIs or external services.

The following headers are added to the **Incoming HTTP Request** in your GTM server container:

| Header             | Contains                  |
| ------------------ | ------------------------- |
| `X-Geo-Country`    | The visitor's country     |
| `X-Geo-Region`     | The visitor's region      |
| `X-Geo-City`       | The visitor's city        |
| `X-Geo-Ipaddress`  | The visitor's IP address  |
| `X-Geo-PostalCode` | The visitor's postal code |

The values are looked up in a geolocation database based on the visitor's IP address and added to the headers.

{% hint style="info" %}
This product includes GeoLite2 data created by MaxMind, available from <https://www.maxmind.com>.
{% endhint %}

### Why use GEO headers?

* **Location-specific targeting** — recognise a user's country, region or city to enable more precise targeting and segmentation.
* **Region-specific settings and consent** — privacy rules (such as GDPR) differ per region, so adjusting tracking behaviour based on a user's location can be crucial. GEO headers help you collect user data in a lawful, compliant way without introducing an overly complex configuration.
* **Seamless integration with sGTM** — because the headers are added at server level, you don't need separate scripts or API calls to get location data.

### Do I need to set anything up?

No. The GEO headers are available automatically and are sent along with every request to your server container.

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FPIrkSLHF8M7UFNA0PPLh%2Fimage.png?alt=media&amp;token=abb4b9fe-e144-447a-9cc7-d4baae622661" alt=""><figcaption></figcaption></figure>

### Using GEO headers in your tags

To use the location data in specific tags, create a **Request Header** variable in your GTM server container.

<figure><img src="https://1274044937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA65KwL1NwewlJbtCXsXd%2Fuploads%2FJzNIjekIRR5EDcE9t3A9%2Fimage.png?alt=media&amp;token=c5a56fea-fb1c-45e3-97b9-2c1a886b8a51" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}

#### Create a new variable

In your GTM server container, go to **Variables** and click **New** under **User-Defined Variables**.
{% endstep %}

{% step %}

#### Choose Request Header

Select **Request Header** as the variable type and enter the header you need as the **Header Name**, for example `X-Geo-Country`.
{% endstep %}

{% step %}

#### Save and use the variable

Give the variable a clear name (for example `Request Header - X-Geo-Country`), save it, and use it in your tags, triggers or other variables wherever you need the location data.
{% endstep %}
{% endstepper %}

Repeat this for each GEO header you want to use.

{% hint style="success" %}
Use the [GTM Preview Mode](/getting-started/using-the-gtm-preview-mode.md) to check the values: open an incoming request and look at its request headers, or check the value of your new variable.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.adpage.io/optimize-your-setup/geo-headers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
