Kentico offers web parts that facilitate quick inclusion of cookie consent functionality to websites.
Including cookie consent on your website
- Open the Pages application.
- Select the page where you want to display the consent message.
- Switch to the Design tab.
- Add the Cookie law and tracking consent or Simple cookie law consent web part onto the page.
Kentico cookies are separated into several cookie levels 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:
- 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 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 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).
All cookies level required for On-line marketing features to work correctly in Kentico EMS
The On-line marketing features 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 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.
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 page.
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.
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.