Opt-in and -out of Tracking

Opt-in and -out of Tracking

Some countries have rules that prevent you from tracking users before they have decided to opt-in or -out. In those cases, you need to call the opt-out method, as described below, and when they then click on the consent button you can enable it again.

When you disable tracking of the users, the solutions will still work, but they won't be personalized for your customers.

 

Setup with CookieBot

Add the following lines of code just above </head> in your HTML. Then we won't track any users before they accept:

<script type="text/javascript">
    hrq = window.hrq || [];
    hrq.push(function(sdk){
        if (!document.cookie.includes("hr_initial_load")){
            document.cookie = "hr_initial_load=true";
            sdk.setTrackingOptOut(true);
        }
    });
</script>

Then just above </body> in your HTML add the following code:

<script type="text/javascript">
    window.addEventListener('CookiebotOnAccept', function (e) {
        hrq=(window.hrq||[]);hrq.push(["setTrackingOptOut", !Cookiebot.consent.marketing]); 
    }, false);
 </script>


Setup with CookieInformation.com

Add the following lines of code just above </head> in your HTML. Then we won't track any users before they accept:

<script type="text/javascript">
    hrq = window.hrq || [];
    hrq.push(function(sdk){
        if (!document.cookie.includes("hr_initial_load")){
            document.cookie = "hr_initial_load=true";
            sdk.setTrackingOptOut(true);
        }
    });
</script>

Then just above </body> in your HTML add the following code:

<script type="text/javascript">
    window.addEventListener('CookieInformationConsentGiven', function(event) {
        hrq = window.hrq || [];
        hrq.push(["setTrackingOptOut", !CookieInformation.getConsentGivenFor('cookie_cat_category')]);
    });
</script>


General setup guidance

To disable the tracking onload you can use the following code-snippet just before </head> in your HTML:

<script type="text/javascript">
    hrq = window.hrq || [];
    hrq.push(function(sdk){
        if (!document.cookie.includes("hr_initial_load")){
            document.cookie = "hr_initial_load=true";
            sdk.setTrackingOptOut(true);
        }
    });
</script>

 

Integration with cookie banners

When the customer gives consent to be tracked, you can call the following JavaScript method:

hrq = window.hrq || [];
hrq.push(["setTrackingOptOut", false]);


and we will begin personalizing the experience for the customer.

 

Opt-out of all cookies

To opt-out of all cookies, the opt-out parameter needs to be set on our script before it loads. Our normal script snippet looks like this:

<script async src="https://helloretailcdn.com/helloretail.js"></script>
<script>
    window.hrq = window.hrq || [];
    hrq.push(['init', {}]);
</script>

This can be modified like this:

<script async src="https://helloretailcdn.com/helloretail.js"></script>
<script>
    window.hrq = window.hrq || [];
    hrq.push(['init', {
        trackingOptOut: true
    }]);
</script>

Notice the "trackingOptOut: true". This boolean can be set to true or false depending on if the visitor should be tracked or not. Since this is set before the script even loads, it will cause all cookies to be blocked.

 

You can find more information about cookie rules and GDPR here, as well as what cookies Hello Retail uses to provide a personalized shopping experience.

Like Follow
  • 3 mths agoLast active
  • 625Views
  • 1 Following