Cookienovo Developer Resources

Below is technical information surrounding Cookienovo banner, mainly focused for developers. There are plans for the future to extend this functionality for more developer friendly stuff like event handleres and direct cookie access.

Inserting script

In order for the website to have Cookienovo baner for tracking and user facing cookie consets, you need to insert script that you have recieved in mail upon registration. You can also find this script in your account on Cookienovo website. Thse script should look like this:

< !-- cookienovo client script -- >
< script site-token='< site-token >' type='text/javascript' src='https://cookienovo.com/assets/client.js'>< / script >

You need to make sure you are inserting this script at the start in the < head > element of the website. Make sure to have the type and src attributes set correctly, as shown here.

Note: Also because Cookienovo banner interacts with GTM (Google Tag Manager), make sure you are inserting the Cookienovo script in the < head > element before the GTM initialization part.

Script Tags

Our Cookienovo banner has two tags you can configure right now, with expansion in mind for more tags in the future.

site-token: This is a compulsary and you need to set this based on the ID you recieved in the mail, or on our website. Make sure you have this set to right UUID, otherwise the Cookienovo banner will not show up.
- UUID

theme: With this setting yoiu can override the theme for the banner to always be in ligh or dark mode.
- light
- dark

Event handling

If you want to handle user consent yourself in other scripts, you can add an event listener on CookienovoUserConsentChanged. An example of this could look something like this:

< script type="text/javascript">
document.addEventListener("CookienovoUserConsentChanged", (e) => {
console.log("cookie changed", e.detail);
});
< / script >

If you want to get the actual values that the user selected, you can look inside the detail object, where the cookie consents objects are supplied. Each object contain the category and a bool value if the user allowed it. An example of this object is:

{"detail": [
{"category": "necessary", "allowed": true},
{"category": "analytics", "allowed": false},
{"category": "functional", "allowed": true},
{"category": "marketing", "allowed": true}
]}

Static Scripts

In order for your cookies to function properly, you should make sure you are indicating a category for that script. Thanks to this category, our Cookienovo banner can then make sure to run or not run those scripts based on user preferences that he sets in the banner. Each script which requires some kind of cookie consent should be defined as follows:

< script type ='text/javascript' cn-category ='analytics' >
// some analytic script

< / script >

Add cn-category attribute with desired cookie consent category. Possible values are:
- functional
- marketing
- analytics
- necessary