Opt-in and -out of Tracking¶
Some countries require that you do not track users until they explicitly opt in. In those cases, set trackingOptOut before the Hello Retail script loads. When the user later consents, set trackingOptOut to false to enable tracking again.
When tracking is disabled, Hello Retail solutions still render, but they are not personalized.
Opt-out of all cookies¶
To opt out of all Hello Retail cookies, set the opt-out parameter before our script loads. The default script snippet looks like this:
<script async src="https://helloretailcdn.com/helloretail.js"></script>
<script>
window.hrq = window.hrq || [];
hrq.push(['init', {}]);
</script>
Modify it like this:
<script async src="https://helloretailcdn.com/helloretail.js"></script>
<script>
window.hrq = window.hrq || [];
hrq.push(['init', {
trackingOptOut: true
}]);
</script>
Set trackingOptOut to true to disable tracking. Because this is applied before the script loads, the Hello Retail SDK will not set any cookies.
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.
To disable tracking on load, add the following code just before </head> in your HTML. This requires a variable that reflects whether the user has consented to marketing cookies. In this example, the variable is named CONSENT_BOOLEAN.
<script>
hrq = window.hrq || [];
hrq.push(function(sdk) {
sdk.setTrackingOptOut(CONSENT_BOOLEAN ? false : true);
});
</script>
Integration with cookie banners¶
When the customer gives consent to be tracked, call the following JavaScript method:
Hello Retail will then start personalizing the experience for the customer.
Below are examples for common consent tools.
Setup with CookieBot¶
Add the following lines of code just above </head> in your HTML to prevent tracking before consent:
<script>
hrq = window.hrq || [];
hrq.push(function(sdk) {
if (!Cookiebot.consent.marketing) {
sdk.setTrackingOptOut(true);
}
});
</script>
Then add the following code just above </body> in your HTML:
<script>
window.addEventListener('CookiebotOnLoad', function (e) {
hrq = window.hrq || [];
hrq.push(["setTrackingOptOut", !Cookiebot.consent.marketing]);
}, false);
</script>
Note
Use the consent category that matches your Cookiebot configuration. This example uses marketing.
Setup with CookieInformation.com¶
Add the following lines of code just above </head> in your HTML to prevent tracking before consent:
<script>
hrq = window.hrq || [];
hrq.push(function(sdk) {
if (!CookieInformation.getConsentGivenFor('cookie_cat_marketing')) {
sdk.setTrackingOptOut(true);
}
});
</script>
Then add the following code just above </body> in your HTML:
<script>
window.addEventListener('CookieInformationConsentGiven', function(event) {
hrq = window.hrq || [];
hrq.push(["setTrackingOptOut", !CookieInformation.getConsentGivenFor('cookie_cat_marketing')]);
});
</script>
Note
Use the consent category that matches your Cookie Information configuration. This example uses cookie_cat_marketing.
Setup with CookieYes¶
Add the following lines of code just above </head> in your HTML to prevent tracking before consent:
<script>
hrq = window.hrq || [];
hrq.push(function(sdk) {
if (document.cookie.includes("advertisement:no")) {
sdk.setTrackingOptOut(true);
}
});
</script>
Then add the following code just above </body> in your HTML:
<script>
document.addEventListener('cookieyes_consent_update', function (eventData) {
const data = eventData.detail;
const optOut = data.rejected.includes("advertisement");
hrq = window.hrq || [];
hrq.push(["setTrackingOptOut", optOut]);
}, false);
</script>
Note
Use the consent category that matches your CookieYes configuration. This example uses advertisement.