Streaming live at 10am (PST)

Cookie consent module in body code


I’m trying to implement some code for a new GDPR cookie consent module for

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; = 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 = {}; = id;
var cdn = ‘//’, 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.

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.


Hi @Daniel_Tiebor great question and thank you so much for reaching out!

Javascript needs to be wrapped in an opening <script> and closing </script> tag to ensure that it fires and does not show up on the published page.

Do you have a link to the resource you’re trying to follow to implement this cookie on your site?


I corrected this and the code is not visible anymore but the cookie consent module is not being excecuted…Is the code wrong or the way I put it on the website. It’s supposed to be embedded in the body.