Hello Retail Opt-in and -out of Tracking

This page will consist of an example on how to opt-in and -out of tracking using Hello Retail in Flight, following this article: https://support.helloretail.com/t/y4hhggx/opt-in-and-out-of-tracking

Using Cookiebot

All we have to do is modify the trackers array inside shop.config.js, make sure to edit the HELLO_RETAIL_ID to correctly load the Addwish script.

Since we're inside of a React App, we need to create a native DOM element and append it to the HTML body, like so:

Copy
Copied
// shop.config.js
import { addwishTracker, loadAddwishScript } from '@jetshop/flight-addwish';

const config = {
    ...,
    trackers: [
        {
            ...addwishTracker(),
            initBrowser() {
                loadAddwishScript('HELLO_RETAIL_ID');

                const script = document.createElement('script');

                script.innerHTML = `
                    window.hrq = window.hrq || [];

                    hrq.push(function(sdk) {
                        if (!window?.Cookiebot?.consent?.marketing) {
                            sdk.setTrackingOptOut(true);
                        }
                    });

                    window.addEventListener('CookiebotOnLoad', () => {
                        window.hrq = window.hrq || [];
                        hrq.push(['setTrackingOptOut', !window?.Cookiebot?.consent?.marketing]);
                    }, false);
                `;

                document.body.appendChild(script);
            }
        }
    ],
}
Copyright © Norce 2023. All right reserved.