# Using CloudFlare for Geolocation

*Article Topics:* [*Setup*](https://docs.toomuchmedia.com/getting-started/common-topics/setup)

NATS uses GeoIP to determine the location of visitors who hit your site. This is to ensure NATS can provide the best reporting to our customers. Should you wish to use CloudFlare IP geolocation, we have provided a way to accomplish this.

CloudFlare's IP Geolocation adds the **cf-ipcountry** header to all requests to your server, while **cf-region-code** adds the visitor's region code. NATS will use these headers, if present, to determine the visitor's country and/or region.&#x20;

{% hint style="info" %}
**Important:** Should the headers not be present, NATS will use the IP\_FILTER settings.
{% endhint %}

## Enable IP Geolocation at Cloudflare&#x20;

1. Log in to your Cloudflare account and go to a specific domain.
2. Go to **Network.**
3. Switch the toggle for **IP Geolocation** to **On**.

Learn more at <https://developers.cloudflare.com/network/ip-geolocation/>.

## Configure in NATS

The **Prefer Cloudflare Geo Location** setting can be found in the Surfer Section of the Configuration Admin, underneath the Tracking settings. Enabling this setting will prioritize the CloudFlare headers, falling back to the settings configured in IP Filter.

<figure><img src="https://2232071635-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWJVne6meHqGT8rzsBdod%2Fuploads%2Folldw3HiKqhYtU4H0zxQ%2Fimage.png?alt=media&#x26;token=f61f0aa1-c2cd-4688-b2de-a7aab9079516" alt=""><figcaption></figcaption></figure>

## Related Articles

{% content-ref url="geoip2" %}
[geoip2](https://docs.toomuchmedia.com/setup/setup/server-setup/geoip2)
{% endcontent-ref %}
