Implement Tracking Cookie Consent

Introduction

Goal

Implement a cookie consent pop-up to let website visitors opt in to tracking by the Relevance Module.

Background

The Relevance Module 'tracks' site visitors using a cookie and stores data gathered about visitors. The module's Personalization, Experiments, and Trends features make use of those data.

To comply with local legislation (for example, the EU "Cookie Law"), it may be required to allow website visitors to opt-out (or explicitly opt-in) of the kind of tracking performed by the Relevance Module. This behavior can be enabled through configuration and relies on the visitor's preference being stored in a cookie.

This page describes how to implement a cookie consent pop-up to let website visitors opt in to tracking by the Relevance Module. It assumes a standard Bloomreach Experience Manager project with the Relevance Module added and uses one of the many available Javascript solutions for cookie consent pop-ups: Cookie Consent by silktide.

Example Implementation

Add the CookieBar Javascript to the Base Layout Template

In repository-data/webfiles/src/main/resources/site/freemarker/common/base-layout.ftl, just before the </head> closing tag, add the following:

<script type="text/javascript">
  window.cookieconsent_options = {"message":"This website uses tracking cookies to ensure you get the best experience on our website",
                                  "dismiss":"Accept",
                                  "theme":"light-top"};
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/cookieconsent.min.js"></script>

Now, any visitor entering the site for the first time will see a "pop-up bar" containing a message about tracking cookies and an "Accept" button to opt in. The visitor's preference will be stored in a cookie named cookieconcent_dismissed, with value yes. No tracking will take place until the visitor has clicked the "Accept" button.

Configure the Relevance Module's Cookie Policy

Using the Console, browse to the node /targeting:targeting.

Add the following properties to enable cookie consent with opt-in and match the cookie name and value set by the script:

/targeting:targeting:
  targeting:consentCookieEnabled: true
  targeting:consentCookieOptIn: true
  targeting:consentCookieName: cookieconsent_dismissed
  targeting:consentCookieValue: yes

For more information about all configuration options, see Configure the Relevance Module's Tracking Cookie Policy.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?