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:
Option A: Simple (Recommended)
Use our pre-configured consent defaults script for quick setup:
<!-- Step 1: Set consent defaults (simple) -->
<script src='https://cookienovo.com/assets/cmp.js'></script>
<!-- Step 2: Load Cookienovo banner (can use defer) -->
<script site-token='<site-token>' type='text/javascript' src='https://cookienovo.com/assets/client.js' defer></script>
Option B: Custom (Advanced)
For advanced users who want to customize consent defaults or region-specific settings:
<!-- Step 1: Set consent defaults (with custom settings) -->
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('consent','default',{
'ad_storage':'denied',
'ad_personalization':'denied',
'ad_user_data':'denied',
'analytics_storage':'denied',
'functionality_storage':'denied',
'personalization_storage':'denied',
'security_storage':'granted',
'wait_for_update':500
});
gtag('set','ads_data_redaction',true);
</script>
<!-- Step 2: Load Cookienovo banner (can use defer) -->
<script site-token='<site-token>' type='text/javascript' src='https://cookienovo.com/assets/client.js' defer></script>
You need to make sure you are inserting this script at the start in the 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 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 you can override the theme for the banner to always be in ligh or dark mode.
- light
- dark
consent-mode: With this setting you can override the consent mode set by the banner. Default value is true. Set this value to "false" if you do not wish to send consent for users.
- "true"
- "false"
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' cn-category='analytics'>
// some analytic script
</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:
<script type="text/javascript">
document.addEventListener("CookienovoUserConsentChanged", (e) => {
console.log("cookie changed", e.detail);
});
</script>
The event detail will contain an array with the consent status for each category:
{
"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:
< <a class="text-green-600">script</a> type ='text/javascript' cn-category ='analytics' ><a class="text-grey-600"><br />// some analytic script</a><br />< / <a class="text-green-600">script</a> >
Add cn-category attribute with desired cookie consent category. Possible values are:
- functional
- marketing
- analytics
- necessary
Consent Mode
Our solution implements relevant Google Consent Mode features. This solution is automatic and does not require user or admin intervention. It sets upon loading the default consent state as mentioned here: Google Developer Documentation
On each users update we also set his consent state as mentioned here: Google Developer Documentation
Consent Mode v2
Our solution fully complies with Google Consent Mode v2. Cookienovo uses a two-part installation that ensures consent defaults are set before any Google tags fire:
Part 1: An inline script that sets Google Consent Mode v2 defaults synchronously (ad_storage, analytics_storage, ad_personalization, ad_user_data all default to 'denied')
Part 2: The Cookienovo banner script (supports defer attribute for better performance)
This approach follows industry standards (same as Cookiebot, CookieHub) and ensures compliance even with async-loaded Google tags. The consent defaults include wait_for_update:500 and ads_data_redaction:true for maximum privacy protection.
For more information please visit relevant Google documentation here: Google Developer Documentation
Debug Functions
CookieNovo provides debug functions that you can run in your browser console to verify Consent Mode v2 implementation. Open your browser console (F12) on any page with CookieNovo installed and run:
// Enable debug mode and run full validation
window.cookienovoDebug.enableDebugMode()
// Run only validation checks
window.cookienovoDebug.runFullValidation()
// Generate compliance report
window.cookienovoDebug.generateComplianceReport()
// Check consent mode status
window.cookienovoDebug.checkConsentMode()
// Test implementation
window.cookienovoDebug.testConsentModeImplementation()
// Check Shopify integration
window.cookienovoDebug.checkShopifyIntegration()
These functions will output detailed information about your Consent Mode v2 implementation, including: compliance score, detected Google tags, implementation issues, and actionable recommendations.
You can also use our online checker at Google Consent Mode v2 Checker to scan your website without opening the console.