I’m trying to implement some code for a new GDPR cookie consent module for https://preview.webflow.com/preview/stoppen?preview=c04ae9d2f382515c73a7029698b94514
I’m trying to implement the following code:
/**
* @file
* evidon.js
*
* All code below this comment is a direct copy of the Javascript from Evidon.
*
*/
(function (id) {
function append(scriptid, url, async) {
var d = document, sn = ‘script’, f = d.getElementsByTagName(sn)[0];
if (!f) f = d.head;
var s = d.createElement(sn);
s.async = true;
s.id = scriptid;
s.src = url;
f.parentNode.insertBefore(s, f);
}
function getRootDomain() {
var parts = window.location.hostname.split(‘.’);
if (parts.length === 2) rootDomain = parts[0];
else if (parts.length > 2) {
// see if the next to last value is a common tld
var part = parts[parts.length - 2];
if (part === ‘com’ || part === ‘co’) {
rootDomain = parts[parts.length - 3]; // go back one more
} else {
rootDomain = part;
}
}
return rootDomain;
}
window.evidon = {};
window.evidon.id = id;
var cdn = ‘//c.evidon.com/’, rootDomain = getRootDomain(), noticecdn = cdn + ‘sitenotice/’;
// pull down the common scripts
append(‘evidon-notice’, noticecdn + ‘evidon-sitenotice-tag.js’, false);
append(‘evidon-location’, cdn + ‘geo/country.js’, true);
append(‘evidon-themes’, noticecdn + id + ‘/snthemes.js’, true);
if (rootDomain) append(‘evidon-settings’, noticecdn + id + ‘/’ + rootDomain + ‘/settings.js’, true);
window.evidon.priorConsentCallback = function () {
// add the tags which need to wait for prior consent
// here. This should be all your advertising tags and
// probably most of your social and tracking tags.
}
})(2025);
I tried to embed the code, add it in the custom code (footer section) but the code is vissable to everybody instead of it executing the cookie consent module what I’m trying to achieve!
What’s going wrong here?
Thanks for your help.