The European Union's new data protection law, the General Data Protection Regulation (GDPR), is meant to protect the data and rights of individuals who are in the European Union and European Economic Area (EU/EEA).
To remain compliant with the GDPR, you must not begin tracking until a lead accepts your site's cookie policy. While Lead Gen & CRM landing pages have this functionality built into their design, there may come a time when you are required to manually refer to and place code that checks for consent.
This article will detail how to address consent tracking measures for websites created outside of Lead Gen & CRM.
Administrators | ✓ | |
Company Managers | ||
Marketing Managers | ||
Sales Managers | ||
Salespersons | ||
Jr. Salespersons |
![]() | Tip: Are you looking for information about Constant Contact’s Email and Digital Marketing product? This article is for Constant Contact’s Lead Gen & CRM product. Head on over to the Email and Digital Marketing articles by clicking here. Not sure what the difference is? Read this article. |
Lead Gen & CRM landing pages have consent banners that allow visitors to provide, deny, or revoke their consent in permitting their information be tracked by the page. This functionality does not extend to websites created outside of Lead Gen & CRM.
As such, for external websites, it is imperative that you set up a function that enables or disables Lead Gen & CRM's tracking code from placing cookies depending on consent or denial of visitors. Code will need to be added to those websites in order for them to remain compliant with the GDPR.
Note: Constant Contact offers Professional Services to assist with custom coding.
To obtain the necessary tracking code information for use with consent banners on external websites, do the following:
KOI-########
set domain value from the Tracking Code box.
Hold on to this value. You will need it soon.
Important: You must obtain the KOI value for the callback function to work
To modify the callback function for consent banner usage, do the following:
<script>(function () { var checkConsent = function () { var results = document.cookie.match('(^|;) ?koiCookieConsent=([^;]*)(;|$)'); if (!results || !results[2]) return; return decodeURIComponent(results[2]) === "1"; }; var setCookie = function (v) { var expires = (new Date((new Date()).getTime() + 324000000000)); document.cookie = 'koiCookieConsent=' + v + '; expires=' + expires.toUTCString(); }; window.runKoiTracking = function () { if (window.koiTrackingRan) return; if (!checkConsent()) setCookie('1'); window.koiTrackingRan = true; var ss = document.createElement('script'); ss.type = 'text/javascript'; ss.async = true; ss.src = 'https://KOI-ZZZZZZZZ.marketingautomation.services/client/ss.js?ver=1.1.1'; var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(ss, scr); }; window.removeKoiConsent = function () { setCookie('0'); }; if (checkConsent()) { runKoiTracking(); } })();</script>
koi-ZZZZZZZZ
portion of the above callback script with your website's KOI-########
set domain value.(function() { var ss = document.createElement('script'); ss.type = 'text/javascript'; ss.async = true; ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'koi-ZZZZZZZZ.marketingautomation.services/client/ss.js?ver=1.1.1'; var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(ss, scr); })();
The provided callback script enables the Lead Gen & CRM tracking code to begin tracking if the visitor accepts the site's cookie policy. The script also disables the Lead Gen & CRM tracking code from tracking the visitor if the visitor denies the site's cookie policy.
Lead Gen & CRM does not provide cookie policy banner code. You will need to obtain this code on your own—either with the help of your developer or by searching online for custom, stock, or template cookie banners. Be aware that some of these online cookie code banners may not allow you to edit their HTML code. Choose your banner carefully and accordingly. In addition, your cookie policy banner code is different from the above tracking code.
That said, Lead Gen & CRM will provide the general code changes you must make to this custom banner. These code changes are necessary so that the Lead Gen & CRM tracking code works with it. This is done by modifying onclick events.
Onclick events can be thought of as the switches that trigger the callback function to tell the Lead Gen & CRM tracking code to either track or not track the visit. To add onclick event code to cookie policy banner buttons, do the following:
<button onclick="window.runKoiTracking()">Accept</button>
<button onclick="window.removeKoiConsent()">Deny</button>
Once set, if the visitor clicks the Accept button, the onclick function will call the tracking script and begin tracking the visit for the duration of the session. If the visitor clicks the Deny button, the onclick function will not call the tracking script and the visitor's session will not be tracked.
Copyright © 2025 · All Rights Reserved · Constant Contact · Privacy Center