---
title: Adding cookie law consent to web pages
---

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

Kentico offers web parts that facilitate quick inclusion of cookie consent functionality to websites.

## Including cookie consent on your website

1. Open the **Pages** application.
2. Select the page where you want to display the consent message.
3. Switch to the **Design** tab.
4. [Add](https://docs.kentico.com/k12sp/developing-websites/developing-websites-using-portal-engine/using-and-configuring-web-parts.md) the **Cookie law and tracking consent** or **Simple cookie law consent** web part onto the page.

Kentico cookies are separated into several [cookie levels](https://docs.kentico.com/k12sp/configuring-kentico/data-protection/working-with-cookies.md) according to their importance in the system. There are three main levels designed to comply with the law regulations.

## Available cookie consent web parts

To display a text message and buttons asking visitors for consent to store cookies in their browsers, use one of the following [web parts](https://docs.kentico.com/k12sp/developing-websites/developing-websites-using-portal-engine/using-and-configuring-web-parts.md):

- **Cookie law and tracking consent**
- **Simple cookie law consent**

Both web parts are implemented by the _\~/CMSWebParts/General/CookieLaw.ascx_ control. The "simple" variant is a preconfigured version of the **Cookie law and tracking consent** web part, set up only for the cookie law consent. By default, the web parts are not styled, so you need to update your site's [CSS stylesheet](https://docs.kentico.com/k12sp/developing-websites/designing-websites-using-css.md) to get the required look and feel.

### Cookie law and tracking consent

This web part offers three cookie levels to choose from:

- **No cookies**
- **Only essential cookies**
- **All cookies**

On each level, actions to switch to the remaining levels are offered. You may customize the text messages, available actions as well as button texts.

The **Default cookie level** setting, which can be set in the **Settings** application under the **System** category, determines the cookie level that visitors have before making a choice via the web part.

- The available cookie level values are _System_, _Essential_, _Editor_, _Visitor_, _All_ as specified on the [Working with cookies](https://docs.kentico.com/k12sp/configuring-kentico/data-protection/working-with-cookies.md) page, with the exception of _None_. The _None_ cookie level cannot be set as a default level because the system cookies are required for critical functionality (such as storing the allowed cookie level).

> **Note:** **_All cookies_ level required for On-line marketing features to work correctly in Kentico EMS**
>
> The [On-line marketing features](https://docs.kentico.com/k12sp/on-line-marketing-features.md) of the Kentico EMS edition only work fully for visitors who have their cookie level set to **All cookies**. For example, the system does not create [contacts](https://docs.kentico.com/k12sp/on-line-marketing-features/managing-your-on-line-marketing-features/contact-management/working-with-contacts.md) for visitors whose allowed cookie level is only _System_ or _Essential_.
>
> You can either set the **Default cookie level** setting to _Visitor_ or _All_, or allow individual visitors to give tracking consent and increase their cookie level. For more information, see [Working with consents](https://docs.kentico.com/k12sp/configuring-kentico/data-protection/gdpr-compliance/working-with-consents.md).

The **Compare current cookie level to** property is a basis for other settings in the web part. It defines a level to which the user's current cookie level is compared. Three states with their own settings are defined depending on the selected level:

- When the current level is below the compared level (**Below level behavior** settings).
- When the current level exactly matches the compared level (**Exact level behavior** settings).
- When the current level is above the compared level (**Above level behavior** settings).

This should give you enough options to configure the web part.

In addition to managing cookie law consents, this web part also allows you to manage consents for tracking of personal data of users. For information about tracking consents, see the [Working with consents](https://docs.kentico.com/k12sp/configuring-kentico/data-protection/gdpr-compliance/working-with-consents.md) page.

> **Info:** **Kentico EMS required**
>
> To utilize all features of the **Cookie law and tracking consent** web part, namely managing tracking consents, you need the **Kentico EMS** license edition.

### Simple cookie law consent

This is a preconfigured version of the previous web part. The preset behavior is: Disable cookies by default, request allowing, and once allowed, hide the web part. To make sure the web part behaves according to the preset behavior, you need to set the **Default cookie level**  setting in the **Settings** -> **System** category to _System_.

> **Info:** **Testing cookie law web parts**
>
> Cookies are used for both the live site and the Kentico administration interface. When a user signs in to the administration interface, the system automatically allows all cookies in the user's browser. This may prevent users from interacting with cookie web parts on the live site. On the other hand, adjusting the cookie level via a cookie web part on the live site may interfere with the administration interface.
>
> To avoid such issues, we recommend testing any changes of cookie level settings and the related web parts in a different browser or computer, or using a separate anonymous/private/incognito window of your current browser.
