---
title: Contact configuration
related:
  - https://docs.kentico.com/documentation/business-users/digital-marketing/contact-management.md
---

> 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).

[Contacts](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-management.md) in Xperience by Kentico represent people who view and interact with content through channels, e.g., visitors of a website. Each contact stores the visitor's personal data and other marketing-related information.

**On websites**, contacts cover both anonymous visitors (identified by an HTTP cookie, depending on the [Default cookie level](https://docs.kentico.com/documentation/developers-and-admins/data-protection/cookies.md)) and users who identify themselves by submitting their name, email address and other data. The system automatically [tracks the activities](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-activities.md) that contacts perform on the website and gathers data about contacts based on the actions and input of the associated visitors.

The collected [contact data](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-management.md) allows marketers to analyze client behavior, optimize content, identify potential buyers, and perform other marketing‑related actions.

> **Info:** **Contacts and channels**
>
> Contacts are global and shared across all content [channels](https://docs.kentico.com/documentation/developers-and-admins/configuration/website-channel-management.md). For example, if you use your Xperience application to run two websites, send messages through an email channel, and deliver content to an external application through a headless channel, visitors and email recipients from all channels will belong to the same pool of contacts.

## Contact tracking requirements

The contact tracking functionality in Xperience is **enabled by default**. However, due to [personal data protection](https://docs.kentico.com/documentation/developers-and-admins/data-protection.md) policies, contacts are only tracked for website channels with the **Default cookie level** set to _Visitor_ or _All_, or if visitors give tracking consent and increase their cookie level. For more information, see [Consent development](https://docs.kentico.com/documentation/developers-and-admins/data-protection/consent-development.md).

## Get the current contact

The system uses the **CurrentContact** browser cookie as persistent storage for the current contact. By default, the storage is empty. However, once you ask for the current contact, the system sets the contact's GUID (unique identifier) to every response cookie.

To get the current contact in the your application's code, call the `ContactManagementContext.GetCurrentContact` method. The context class and method are available in the `CMS.ContactManagementont` namespace.

```csharp
using CMS.ContactManagement;

...

// Gets the current contact
ContactInfo currentContact = ContactManagementContext.GetCurrentContact();
```

If there is no contact related to the currently processed request, the `GetCurrentContact` method automatically creates and returns a new anonymous contact by default. You can disable the automatic creation of new contacts by calling the method with a `false` bool parameter.

> **Tip:** **Contact management services and dependency injection**
>
> If you wish to use the [dependency injection](https://docs.kentico.com/documentation/developers-and-admins/development/website-development-basics/dependency-injection.md) design pattern, you can create a custom service to provide the required contact management functionality. Call the methods of the `ContactManagementContext` class within the service's implementation.

## Configure contact tracking

Depending on the project requirements, developers and administrators can adjust how the system recognizes contacts or processes contact data. This enables marketers to work with contacts more efficiently.

- [Set up deletion of inactive contacts](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/contact-configuration/delete-inactive-contacts.md) (to reduce the required storage size and mitigate performance issues)
- [Create custom contact recognition logic](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/contact-configuration/contact-recognition-logic.md)
- [Change the logging interval for contact data updates](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/set-up-activities.md#activity-and-contact-update-processing) (contact updates are batch processed and logged at an interval together with activities)
- [Map custom member fields to contacts](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/contact-configuration/map-custom-member-fields-to-contacts.md) (if your project allows visitors to [register as members](https://docs.kentico.com/documentation/developers-and-admins/development/registration-and-authentication.md) and you use [custom member fields](https://docs.kentico.com/documentation/developers-and-admins/development/registration-and-authentication/add-fields-to-member-objects.md))

## Add custom fields to contacts

Custom fields can help you store and organize additional data about your contacts, for example, if you wish to integrate Xperience by Kentico with a third-party CRM.

To add custom contact fields, [extend](https://docs.kentico.com/documentation/developers-and-admins/customization/object-types/extend-system-object-types.md) the **Modules → Contact data management → Classes → Contact management - Contact** system class.

> **Tip:** **Include custom fields in contact field selectors**
>
> When configuring the _Contact has value in field_ or _Contact field value is empty_ condition in [contact groups](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-groups.md) or [automation](https://docs.kentico.com/documentation/business-users/digital-marketing/automation.md#rule-based-conditions) or setting [mappings of form fields to contact attributes](https://docs.kentico.com/documentation/business-users/digital-marketing/forms/create-and-edit-forms.md#map-form-submission-to-contact-attributes), the system provides selectors of contact fields.
>
> To include your custom contact fields in these selectors, you need to [add the fields](https://docs.kentico.com/documentation/developers-and-admins/customization/object-types/extend-system-object-types.md#extendsystemobjecttypes-uiforms) to the **Contact edit** UI form of the _Contact management - Contact_ class. Contact field selectors display custom fields with the text entered as the **Field caption** of the corresponding UI form field.
>
> Note: Fields with the _Date_ or _Date and time_ data type are not supported in contact field selectors.

If your custom contact fields use a [custom data type](https://docs.kentico.com/documentation/developers-and-admins/customization/field-editor/add-custom-data-types.md), you need to ensure the empty value for this data type is configured when using a _Contact field value is empty_ [contact group](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-groups.md) or [automation](https://docs.kentico.com/documentation/business-users/digital-marketing/automation.md#rule-based-conditions) condition. You can [configure the empty value](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/contact-configuration/configure-custom-contact-field-empty-values.md) by extending the `IContactFieldEmptyValueProvider` service using the [decorator pattern](https://docs.kentico.com/documentation/developers-and-admins/customization/decorate-system-services.md). Additionally, you can change the empty values provided by the system for the default field data types.
