General FAQs

Adding a cookie notification JavaScript using Geo Javascript

C

Hi there, I just created a geo javascript called Cookie Notification to activate a notification on our website when someone from the EU (and Canada currently) comes to our website. Problem is: the code is actually HTML, not javascript so I don't know if this causes problems. I added this html as a tag on Google Tag Manager first to make sure it works, and it did. But even though I've added the GeoTargetly script to my website via GTM, the cookie notification doesn't appear to be working. Is there a problem with something I've done?

GT
Answer
by Geo Targetly

The only way around this, if you can't paste our Geo Content code in your site, is to convert this html into javascript.

Basically the html needs to be injected into your site using javascript.

The other option is to convert the HTML to JavaScript by using JavaScript to Inject the HTML

This is how the converted HTML will look like when used with our Geo Javascript service:

var notification =

'<div class="notification pos-left pos-bottom" data-animation="from-bottom" data-autoshow="200" data-cookie="dismissed-cookie-notification">'+
'<div class="boxed boxed--border border--round box-shadow col-md-4">'+
'<div class="text-block">'+
'<h5>Cookies</h5>'+
'<p>'+
'Our website uses cookies to improve your user experience. We have updated our <a href="
">Privacy Policy</a> to reflect how cookies are used on our website. By clicking "Accept", or closing this notification, you agree to our use of cookies and similar technologies.'+
'</p>'+
'<a class="btn btn--primary type--uppercase notification-close">'+
'<span class="btn__text">'+
'Accept'+
'</span>'+
'</a>'+                                                      
'</div>'+
'</div>'+
'</div>'

document.body.innerHTML = document.body.innerHTML + notification;

Tags:

"Hands down one of the best marketing tools you are not using"

Chad T. - Web & Digital Media Director

Get started in minutes
No credit card required
Free on-boarding support
Your Privacy

We uses cookies to improve your experience on our site, analyse site traffic and to show you relevant content. By using our website, you consent to our use of cookies. For more information please, see our Privacy Policy

ACCEPT ALL
ACCEPT NECESSARY
REJECT ALL