DG and Privacy UX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Consent Solutions Knowledge Base

UCP Example Page for Consent Tool Link Implementation

We have customers that would like our consent tool to be available from other pages of their site such as their Privacy or Cookie Policy Page.  This is a test page showing how that can be done.  

1.  Navigate to http://noticedemo.evidon.com/Teresa/consentonpolicy.html
2.  Click on the `Cookie Policy Page` link at the top left of the page  (You can click to Accept the banner or not.  If you do not Accept the banner, it will fire on the Cookie Policy Page as well.)
Consenttool1.PNG
3.  Click on `Cookie Consent Tool` link at the top left of the Cookie Policy Page
consenttool2.PNG


4.  Observe the L3, Consent Tool open on the page
consenttool3.PNG


5.  Right click to View Page Source in Chrome

 

<html>
<head>
<meta charset="UTF-8">
<title>Simple Page</title>
</head>

<body style="background:#d6d6d6;">
<div class="evidon-notice-link"></div>

<script type="text/javascript">
    (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/';
        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 (categories, vendors, cookies) {
            // 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.
        }

        window.evidon.closeCallback = function () {
            // this is executed if the user closed a UI element without either Accepting (providing consent)
            // or Declining (declining to provide consent).
        }

        window.evidon.consentWithdrawnCallback = function () {
            // this is exeucted if the user withdraws consent and elects to
            // no longer allow technologies to run on the site.
        }

        window.evidon.consentDeclinedCallback = function () {
            // this is executed if the user explicitly declines giving consent by
            // using a Decline button
        }
		
		setTimeout(function () {
                   window.evidon.notice.setDomain('doesitallwork.com');
               }, 2000);

		
		
    })(4996);
</script>


<h1>Cookie Policy Page</h1>
<br>
<a href="#" onclick="event.preventDefault(); window.evidon.notice.showConsentTool();">Cookie Consent Tool</a>


</body>
</html>

 

6.  Observe the cookie banner tag dropped on the page in the <script> tag.  This script will be needed on the page for the showConsentTool() method to read the notice object.

7.  Observe the anchor tag (<a>) around the Cookie Consent Tool text.  You can use this <a> tag around any text to link up the consent tool. 

The href="#" onclick="event.preventDefault(); prevents default behavior, which is to navigate to the location in the href attribute, which could cause the page to reload. 
The window.evidon.notice.showConsentTool(); calls our API, located in our notice object, and triggers the consent tool to display.

See more information on Consent tool implementation here:
UCP - Implement Consent Tool Link
Universal Consent tool link implementation tips

Labels (2)
Version history
Revision #:
4 of 4
Last update:
‎10-15-2019 05:47 PM
Updated by:
 
Looking for more?
Ask in Discussions
Developers

Peer-to-peer support  and answers on developing CMS templates, modifying privacy scripts or building integrations.

Digital Experience Management

Find answers and ask questions on content management, personalization and targeting.

Digital Quality Management

Find answers and ask questions on WCAG and SEO quality management.

Digital Governance

Find answers and ask questions on consent and monitoring solutions.