---
title: Introduction to data protection
---

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

This module takes a detailed look at Data protection in Xperience by Kentico, diving into complex examples.

We'll go over how to build all of the following:

- A mapping between consents and custom cookie levels
- A widget allowing visitors to consent to different cookie levels
- A tracking consent banner to accept all consent levels at once
- A Page builder section that hides its contents from visitors who have not consented to tracking
- An identity collector to gather contacts associated with a given email
- A data collector to collect personal information associated with provided contacts
- A data eraser to remove all data associated with provided contacts

> **Note:** Some of the materials in this module are not exclusive, and may look familiar if you've already completed other modules.

### Prerequisites

This module's hands-on materials require the following:

- Familiarity with [C#](https://learn.microsoft.com/en-us/dotnet/csharp/), [.NET Core](https://learn.microsoft.com/en-us/dotnet/), [Dependency injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection), and the [MVC pattern](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview).
- A running instance of Xperience by Kentico, preferably [29.6.1](https://docs.kentico.com/changelog.md) or higher.

  > **Note:**&#x20;
  >
  >  Some features covered in the Training guides may not work in older versions. 
- Basic experience using [Page Builder widgets](https://docs.kentico.com/documentation/developers-and-admins/development/builders/page-builder/widgets-for-page-builder.md).

> **Tip:** The example presented in this [Data protection series](https://docs.kentico.com/guides/development/data-protection.md) is a **valid implementation of data protection for [Contacts](https://docs.kentico.com/documentation/business-users/digital-marketing/contact-management.md)** in Xperience by Kentico. (Note that it does not cover the collection and erasure of [Members](https://docs.kentico.com/documentation/business-users/members.md) and their associated data.)
>
> You can copy-paste the code samples into your own solution.
>
> However, if you choose to do so, **make sure to consult your legal team** to determine whether the implementation, texts, and consent levels **meet the requirements of your region and market**.

> **Info:** **Code samples**
>
> You can find a project with completed, working versions of code samples from this module and others in the [finished branch](https://github.com/Kentico/xperience-by-kentico-training-guides/tree/finished) of the _Training guides_ repository.
>
> The [main branch](https://github.com/Kentico/xperience-by-kentico-training-guides) of the repository provides a starting point to code along with the guides.
>
> The code samples in this guide are for [.NET 8](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8/overview) only.
>
> They come from a project that uses [implicit using directives](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview#implicit-using-directives). You may need to add additional `using` directives to your code if your project does not use this feature.
