Skip to content

Opt-in and -out of tracking

If you want to stop tracking users you can use one of the following options:

  • Using the JavaScript function below that is typically used in integration with a cookie plugin. A few examples can be found here. If the tracking is disabled, the recommendations and search functionalities are not personalized. We will store it on a cookie that the user doesn't want to be tracked, so you only need to set this once.

    ❗ Note: Since tracking is done through Cookie, there is only a JavaScript SDK function and not a REST-API call for this functionality.

    Argument     Type Description    
    optout     Boolean true to opt out, false to opt back -in
    hrq = window.hrq || [];
    hrq.push([
        "setTrackingOptOut", 
        optout
    ]);
    

    Disable tracking of the current user:

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

    To opt back into being tracked:

    hrq = window.hrq || [];
    hrq.push([
        "setTrackingOptOut", 
        false
    ]);
    
  • Adding the trackingOptOut parameter to the init command that is part of the Hello Retail snippet and setting it to true to prevent any setting of cookies by the Hello Retail script. The result will be the same as calling the opt-out JavaScript function in the Hello Retail JavaScript SDK. The difference between this option and the SDK function is that the SDK function uses a cookie to remember the opt-out while using the trackingOptOut parameter allows you to manage cookie consent before Hello Retail is loaded and ensure Hello Retail does not set any cookies at all.  

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

Get current state

Use the getTrackingOptOut method to get the current state of tracking opt-out for the current user. Use this to check whether a customer has opted out of tracking or not.

hrq = window.hrq || [];
hrq.push([
    "getTrackingOptOut",
    function(optout) {
        // If optout is true the user has opted out        
    }
]);