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">
    _awev=(window._awev||[]);_awev.push(["bind", "before_crawl", function(){
        if (!document.cookie.includes("hr_initial_load")){
            document.cookie = "hr_initial_load";
            ADDWISH_PARTNER_NS.api.user.set_tracking_optout(true);
        }
    }]);
</script>

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

<script type="text/javascript">
    window.addEventListener('CookiebotOnAccept', function (e) {
        if (Cookiebot.consent.marketing) {
            _awev=(window._awev||[]);_awev.push(["bind_once", "before_crawl", function(){
                ADDWISH_PARTNER_NS.api.user.set_tracking_optout(false);
            }]); 
        }
    }, 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">
    _awev=(window._awev||[]);_awev.push(["bind", "before_crawl", function(){
        if (!document.cookie.includes("hr_initial_load")){
            document.cookie = "hr_initial_load";
            ADDWISH_PARTNER_NS.api.user.set_tracking_optout(true);
        }
    }]);
</script>

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

<script type="text/javascript">
    window.addEventListener('CookieInformationConsentGiven', function(event) {
        if (CookieInformation.getConsentGivenFor('cookie_cat_category')) {
            _awev = (window._awev || []); _awev.push(["bind_once", "before_crawl", function () {
                ADDWISH_PARTNER_NS.api.user.set_tracking_optout(false);
            }]);
        }
    });
 </script>


General setup guidance

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

_awev=(window._awev||[]);_awev.push(["bind", "before_crawl", function(){
    if (!document.cookie.includes("hr_initial_load")){
        document.cookie = "hr_initial_load";
        ADDWISH_PARTNER_NS.api.user.set_tracking_optout(true);
    }
}]);

 

Integration with cookie banners

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

_awev=(window._awev||[]);_awev.push(["bind_once", "before_crawl", function(){
    ADDWISH_PARTNER_NS.api.user.set_tracking_optout(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>
    (function() {
        var aws = document.createElement('script');
        aws.type = 'text/javascript';
        if (typeof(aws.async) != "undefined") { aws.async = true; }
        aws.src = 'https://d1pna5l3xsntoj.cloudfront.net/scripts/company/awAddGift.js#{{partner id}}';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(aws, s);
    })();
</script>

This can be modified like this:

<script>
    (function() {
        var aws = document.createElement('script');
        aws.type = 'text/javascript';
        if (typeof(aws.async) != "undefined") { aws.async = true; }
        aws.src = 'https://d1pna5l3xsntoj.cloudfront.net/scripts/company/awAddGift.js#{{partner id }},tracking_optout=true';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(aws, s);
    })();
</script>

Notice the "tracking_optout=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 wk agoLast active
  • 326Views
  • 1 Following