CookieHub on multiple domains/hosts

Sharing consents between hosts

CookieHub is configured by default to share consents between all host within a single domain. Meaning that if a user enters www.example.org for the first time, he'll get the CookieHub widget asking for consent. If the user then enters another host within the same domain (ex. shop.example.org) and the same widget code is loaded there, the user won't see the CookieHub widget again since he has already consented.

In order to make this functionality work, you'll need to add all hosts where CookieHub will be used in the Hosts tab in the portal to include them in the cookie scan and make sure the same CookieHub widget code is loaded on all hosts.

Don't share consents between hosts

If you want to load different CookieHub widget code on different hosts within the same domain in order to customize the user interface or functionality, you'll have to make minor modifications to the code to tell CookieHub how to store the user's choices.

The default CookieHub widget code looks like this:

<script type="text/javascript">
var cpm = {};
(function(h,u,b){
var d=h.getElementsByTagName("script")[0],e=h.createElement("script");
e.async=true;e.src='https://cookiehub.net/c2/xxxxxxxx.js';
e.onload=function(){u.cookiehub.load(b);}
d.parentNode.insertBefore(e,d);
})(document,window,cpm);
</script>

Change the cpm object to include empty cookie domain:

<script type="text/javascript">
var cpm = {
  cookie: {
    domain: ''
  }
};
(function(h,u,b){
var d=h.getElementsByTagName("script")[0],e=h.createElement("script");
e.async=true;e.src='https://cookiehub.net/dev/c2/xxxxxxxx.js';
e.onload=function(){u.cookiehub.load(b);}
d.parentNode.insertBefore(e,d);
})(document,window,cpm);
</script>

The value of the domain property must be empty and it will instruct the browser to set the cookie on the current domain instead of the top level domain which is the default value.

Still need help? Contact Us Contact Us