Working with consents

Kentico EMS required

Features described on this page require the Kentico EMS license.

In Kentico, consents are records used to inform website visitors about the means of collecting and manipulating their personal data. This page describes how to display created consents on websites, enable visitors to give consent agreements, and serve content based on received consents.

When creating a consent for the tracking of contacts and activities, you also need to provide a way for visitors to adjust their allowed cookie level. The system only performs the tracking for visitors whose cookie level is Visitor or higher (i.e., All cookies in the configuration of cookie law web parts).

Prerequisites

On-line marketing must be enabled to allow contact creation:

  1. Open the Settings application.
  2. Navigate to the On-line marketing category in the settings tree.
  3. Select the Enable on-line marketing check box.
  4. Click Save.

To ensure that visitors are not tracked until they give the tracking consent, you need to set the default cookie level for your website:

  1. Open the Settings application.

  2. Navigate to the System category in the settings tree.

  3. Set the value of the Default cookie level setting to System or Essential.

    With the System cookie level, basic functionality such as authentication and language selection will not work for visitors by default.

    If possible, we recommend setting the level to Essential (or higher if you are not legally required to obtain tracking consent). However, you may need to verify that the Essential cookies are compliant with any applicable legal requirements and regulations.

  4. Click Save.

To allow visitors to give or revoke agreements with the tracking consent:

  1. Open the Pages application.
  2. Add the Cookie law and tracking consent web part to a suitable location on your website (we recommend the main master page that defines the shared content of all pages).
  3. Select an appropriate consent via the web part’s Tracking consent property (in the On-line marketing category).
  4. Configure the web part in a way that allows visitors to enable All cookies.
  5. Click Save & Close.

Now when a visitor arrives on your website, the system does not track them as a contact until they give their consent via the Cookie law and tracking consent web part. For visitors whose cookie level is lower than Visitor (i.e. No cookies or Only essential cookies in the web part configuration), the web part additionally displays the Short text of the selected tracking consent.

When a visitor changes their allowed cookie level, the web part automatically manages agreements for the assigned tracking consent:

  • When a visitor raises their cookie level to All cookies, a consent agreement is created for the new contact.
  • If a visitor lowers their cookie level, the corresponding tracking consent agreement is revoked.

The following is a sample configuration of the Cookie law and tracking consent web part. You can modify the properties and use this as a basis for your own setup.

  • Levels category:

    • Compare current cookie level to: All cookies
  • Below level behavior category:

    • If level is below, display: Enabled
    • Text: Only system cookies are currently stored. Tracking of activities and analytics features are disabled.
    • Show deny button: Disabled
    • Show allow specific button: Disabled
    • Show allow all button: Enabled
  • Exact level behavior category:

    • If level matches, display: Enabled
    • Text: The website now stores cookies on your computer, tracks activity, creates personalized content and processes analytics. You can find more information on our privacy page.
    • Show deny button: Disabled
    • Show allow specific button: Disabled
    • Show allow all button: Disabled
  • Above level behavior category:

    • If level is above, display: Disabled
  • Consent buttons category:

    • Allow all button text: I agree
  • On-line marketing category:

    • Tracking consentSelect the consent to which you want visitors to give consent
    • Consent reference markup: Add any HTML content that you wish to render after the short text of the selected consent. For example, it can be used to display a pop-up window or a link to a page with the full-text version of the consent.

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.

Adding consents to on-line forms

To collect consent agreements regarding the processing of personal data submitted by visitors through on-line forms, utilize the Consent agreement form control.

  1. Open the Forms application and edit () the form to which you want to add the option to give consent.
  2. Switch to the Fields tab.
  3. Click New field and set the following properties:
    • Field name: Consent
    • Data type: Unique identifier (GUID)
    • Form control: Consent agreement
    • Editing control settings -> Consent: Select the desired consent
  4. Click Save.
  5. Move the consent field to the appropriate location within the form.
  6. If you use a custom form layout, switch to the Layout tab and edit the form layout to display the consent field.

The consent field in the resulting form displays a check box, followed by the Short text of the given consent. When a visitor selects the consent checkbox and submits the form, the system automatically creates a corresponding consent agreement for the given contact.

Consent agreement field displayed in a form

Note: The system does not support consent fields that are required. If you enable the Required property for consent fields, the validation will always fail (the system sets the field’s value only after the form is submitted).

Adding consents to newsletter subscriptions

To collect consent agreements from visitors who subscribe to newsletters, utilize the Custom subscription form web part and an alternative form with a field using the Consent agreement form control.

To ensure that consent agreements are recorded correctly for each subscriber, make sure that the Newsletter - Subscriber class is configured to map the subscription form’s Email address field to the email address contact attribute.

  1. Open the Modules application.
  2. Edit () the Email marketing module.
  3. Select the Classes tab and edit the Newsletter - Subscriber (newsletter.subscriber) class.
  4. Open the Alternative forms tab.
  5. Edit the alternative form that you use for subscriptions on your website.
  6. Switch to the Fields tab.
  7. Add a New field using the Consent agreement form control. See Adding consents to on-line forms for details.
  8. Click Save.
  9. If you use a custom form layout, switch to the Layout tab and edit the form layout to display the consent field.

Make sure that pages containing your newsletter subscription form use the Custom subscription form web part with the correct alternative form.

  1. Open the Pages application and select the appropriate page.
  2. Switch to the Design tab and place the Custom subscription form web part.
    • Select the correct Alternative form.

      To allow signed in users to give consent agreements, you need to disable the One-click subscription for signed in users property of the Custom subscription form web part.

  3. Click Save & Close.

The consent field in the resulting form displays a check box, followed by the Short text of the given consent. When a visitor selects the consent checkbox and submits the subscription form, the system automatically creates a corresponding consent agreement for the given contact.

Adding consents to user registration

To collect consent agreements from visitors who register as new users, utilize the Custom registration form web part and an alternative form with a field using the Consent agreement form control.

To ensure that the consent agreements are recorded correctly for each visitor, make sure that:

  • Your registration form contains an Email address field
  • The User class is configured to map the given email address field to the email address contact attribute
  1. Open the Modules application.
  2. Edit () the Membership module.
  3. Select the Classes tab and edit the User (cms.user) class.
  4. Open the Alternative forms tab.
  5. Edit the alternative form that you use for registration on your website.
  6. Switch to the Fields tab.
  7. Add a New field using the Consent agreement form control. See Adding consents to on-line forms for details.
  8. Click Save.
  9. If you use a custom form layout, switch to the Layout tab and edit the form layout to display the consent field.

Make sure that your site’s registration page contains the Custom registration form web part with the correct alternative form. For more information about custom registration forms in general, see Using the Custom registration form web part.

  1. Open the Pages application and select your registration page.

  2. Switch to the Design tab and place the Custom registration form web part.

    • Select the correct Alternative form.
  3. Click Save & Close.

The consent field in the resulting form displays a check box, followed by the Short text of the given consent. When a visitor fills in the registration form and selects the consent checkbox, the system automatically creates a corresponding consent agreement for the given contact.

Displaying consents on the live site

To display the short and full text of consents on the live site, for example on your website’s privacy policy page, first get the consent object using the GlobalObjects.Consents.<ConsentCodeName> macro (use the indexer macro format GlobalObjects.Consents[“<ConsentCodeName>”] if the code name contains any special characters, like a hyphen). Then call the consent object’s GetConsentText() macro method, which returns a ConsentText object providing consent text values in its ShortText and FullText properties.

By default, the GetConsentText() macro method returns consent texts in the culture selected by the current visitor. To get a specific culture version of the consent text, add the cultureCode parameter: GetConsentText(string cultureCode)

  1. Open the Pages application.

  2. Navigate to a page where you want to add the consent text.

  3. Add a Static text web part to the page.

  4. In the web part’s configuration, enter HTML content with the required macros into the Text property (under the Content category).

    Example
    
    
    
     <h3>{% GlobalObjects.Consents["DancingGoatMachineRentalForm"].ConsentDisplayName %}</h3>
     <p>{% GlobalObjects.Consents["DancingGoatMachineRentalForm"].GetConsentText().ShortText %}</p>
     <p>{% GlobalObjects.Consents["DancingGoatMachineRentalForm"].GetConsentText().FullText %}</p>
    
    
     
  5. Click Save & Close.

Kentico does not provide any ready-to-use components for revoking consent agreements. Each website has its own personal data processing requirements and its own unique set of consents, so your developers need to create custom components for this purpose.

See Revoking consent agreements for details.

Creating macro conditions based on given consents

You can use the AgreedWithConsent macro method and the Contact has agreed with consent macro rule to check if a contact has given an agreement with a specified consent. You can use them in the following ways:

The AgreedWithConsent macro method resolves to false even if called for a contact object that does not exist. This is important, because if a visitor does not accept the tracking consent, the system does not create a contact associated with this visitor (i.e. OnlineMarketingContext.CurrentContact is null).

  • On the live site, you can use the macro to build conditional content based on the current contact’s consents. For example, to display different text to visitors who have given an agreement with a consent:

    1. AddStatic text web part to a page.

    2. Enter the following code into the Text property under the Content category.

      
      
      
       {% if (OnlineMarketingContext.CurrentContact.AgreedWithConsent("ConsentCodeName")) {"Thank you for accepting the consent."} else {"Please accept the consent."} %}
      
      
       
  • On the live site, you can use the macro to adjust the properties of web parts. For example, to show a web part only to those visitors who have given an agreement with a consent:

    1. Modify an existing web part.

    2. Expand the Visibility category. Click the Edit value icon () next to the Visible check box to enter a macro condition.

    3. Enter the following code into the editor:

      
      
      
       {% OnlineMarketingContext.CurrentContact.AgreedWithConsent("ConsentCodeName") %}
      
      
       
  • In on-line marketing modules such as personas, contact scoring, marketing automation and contact groups you can use the macro rule to create rules and segment visitors. For example, to create a contact group which contains users who have given an agreement with a consent:

    1. Set up a condition-based contact group.
    2. Click Edit next to the Macro condition field to open the Rule designer interface.
    3. Use the Contact has agreed with consent rule and select the desired consent.