---
title: Using geolocation for contacts
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

> **Info:** **Kentico EMS required**
>
> Features described on this page require the **Kentico EMS** license.

You can use geolocation to determine the origin (real world geographic location) of your website visitors based on their IP address. The system obtains the geographic data using [MaxMind's GeoIP databases](http://www.maxmind.com/app/ip-location). The default database is _GeoLite City_, which is the most accurate one of the free IP geolocation databases. You can extend the accuracy of the feature by downloading additional databases.

> **Note:** **Note**
>
> The system only determines the geographic location of [contacts](https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/contact-management/working-with-contacts.md) during their first visit on a website. The information is not updated when the same contact accesses your websites again from a different location.

## Configuring geolocation

To set up geolocation for your websites:

1. Open the **Settings** application.
2. Navigate to **On-line marketing -> Contact management -> Geolocation**.
3. Check **Enable contact geolocation by IP**.
4. (Optional) Enter a geolocation **Suffix**.
   - The system adds the suffix to the values of all text-based contact fields that are obtained using geolocation.
5. Configure the mappings of the GeoIP fields to Kentico contact fields.

   > **Info:** **Note**
   >
   > By default, Kentico contacts do not have an equivalent of the following fields:
   >
   > - Area code
   > - Metro code
   > - DMA code
   > - Latitude
   > - LongitudeTo create custom fields for holding the data:
   >
   > 1. Open the **Modules** application.
   > 2. Edit the **Contact management** module.
   > 3. On the **Classes** tab, edit the **Contact management - Contact** class.
   > 4. [Define the fields](https://docs.kentico.com/k10/custom-development/developing-form-controls/assigning-form-controls-to-fields.md) on the **Fields** tab.

> **Note:** **Field data type restrictions**
>
> Mind the following type restrictions when assigning target fields for the GeoIP data:
>
> | Field                                    | Only accepts                                                                                                                                                      |
> | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
> | **Country**                              | Integer-based and text-based columns.<br>When mapping to integer fields, the _Country ID_ value is used<br>Text-based fields use the _Country display name_ value |
> | **State**                                | Integer-based and text-based columns.<br>When mapping to integer fields, the _State ID_ value is used<br>Text-based fields use the _State display name_ value     |
> | **City**                                 | Text‑based columns.                                                                                                                                               |
> | **Postal code**                          | Integer‑based and text‑based columns.                                                                                                                             |
> | **Area code**                            | Integer‑based and text‑based columns.                                                                                                                             |
> | **Metro code**                           | Integer‑based and text‑based columns.                                                                                                                             |
> | **DMA code**                             | Integer‑based and text‑based columns.                                                                                                                             |
> | **Latitude**                             | Decimal‑based and text‑based columns.                                                                                                                             |
> | **Longitude**                            | Decimal‑based and text‑based columns.                                                                                                                             |
> | **Organization/ISP (GeoIPOrg required)** | Accepts text-based columns. Geolocation only updates this field if the [GeoIP Organization Database](#adding-geoip-organization) is installed.                    |

6. Click **Save**.

## Managing your MaxMind databases

You can improve the functionality of geolocation by using more detailed and accurate databases and by keeping your current databases up to date.

### Adding GeoIP City

The **GeoIP CIty** database provides more accurate results than the default _GeoLite City_ database.

1. Obtain the [GeoIP City](http://www.maxmind.com/app/city) database.
2. Place the database file into the _\~/App\_Data/CMSModules/WebAnalytics/MaxMind/_ folder of your web project.
3. Configure the system to use the new geolocation database by adding the following key to the _appSettings_ section of your _web.config_ file.

   - Specify the name of the database file as the key's value.

```html

<add key="CMSGeoIPLocationFileName" value="GeoIPCity.dat" />

```

Geolocation now uses the _GeoIPCity.dat_ database instead of the default _GeoLiteCity.dat_ database.

### Adding GeoIP Organization

The **GeoIP organization** database allows the system to determine the organization name of visiting contacts.

Note that the database only contains data for large corporations and organizations, and does not have guaranteed accuracy. We recommend contacting MaxMind support for more information about the accuracy of the organization data.

1. Obtain the [GeoIP organization](http://www.maxmind.com/app/organization) database.
2. Place the database file into the _\~/App\_Data/CMSModules/WebAnalytics/MaxMind/_ folder of your web project.

   > **Note:** **Note**: The name of the database file must be **_GeoIPOrg.dat_.**

Geolocation now supports organization detection.

### Updating existing databases

To ensure that the geolocation data is accurate, you need to regularly update your MaxMind databases.

To update your databases, download the newest version and upload the database file to your web project's _\~/App\_Data/CMSModules/WebAnalytics/MaxMind/_ folder.
