ProductTeam
Community Manager
Community Manager

Granular consent tag wrapping with UCP when not using a tag manager

While we encourage using a tag manager for utilizing granular consent with Evidon’s UCP functionality, sometimes that is not possible.

Note: This document details additional high-level steps outside of the general documentation.

Generating a tag for granular consent

The first step in this process is to pull the UCP tag with the appropriate consent granularity you wish to use.  To do so, follow these steps:

  1. From the Evidon Privacy UI, click Manage.
  2. From the Site Notices page, click Get Site Notice Tag.
  3. Click the Select Tag Type drop-down, and select Site Notice Tag. The UCP tag code displays.
  4. Click the Select Consent Level drop-down to select your specific tag for granular consent, and, depending on the consent level you wish to utilize on your property, select either Categories or Vendors. This automatically adds either all categories or vendors used across all notices on your account within the priorConsentCallback.

    Displays Site Notice Tags screen and the Select Consent Level drop-down with the Categories and Vendors options.Displays Site Notice Tags screen and the Select Consent Level drop-down with the Categories and Vendors options.
    Displays Categories option with code block highlighted.Displays Categories option with code block highlighted.
    Displays the Vendors option with code blocked highlighted.Displays the Vendors option with code blocked highlighted.
  5. Copy the tag that you wish to use and place it directly on your page.
  6. Next, you'll wrap the tags using either the proper category or vendor name. You can identify the proper tag categories for each vendor on your notice by one of two ways:

    Note: You cannot use both methods at once. You must pick either category or vendor level.

    1. Placing the tag on the page and clicking Learn More to expand the category. This displays a list of vendors in that category; or,
      Displays example of Categories and Learn more links highlighted.Displays example of Categories and Learn more links highlighted.Displays example of Analytics Provider options highlighted.Displays example of Analytics Provider options highlighted.
    2. From the Privacy UI, click VendorsClick the arrow next to a vendor to see which category the vendor is in for each site notice:
      Displays Vendors screen with Vendor Names highlighted.Displays Vendors screen with Vendor Names highlighted.

  7. Once you've identified the correct categories, you're ready to wrap tags for either category or vendor level consent.

Category level tag wrapping

On your category level tag, the priorConsentCallback will look something like the below example:

Note: The category names will differ depending on how you choose to set them up.

      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. 

            var handlers = { 

                categories: { 

                    'all': 'handleAllCategories', 

                    'ad network': 'handleAdNetwork', 

                    'ad server': 'handleAdServer', 

                    'ad verification': 'handleAdVerification', 

                    'agency': 'handleAgency', 

                    'analytics provider': 'handleAnalyticsProvider', 

                    'business intelligence': 'handleBusinessIntelligence', 

}, 

                vendors: {} 

            }; 

            for (var category in categories) { 

                if (!categories[category]) continue; 

                var handler = window.evidon[handlers.categories[category]]; 

                if (typeof handler === 'function') handler(); 

            } 

            for (var vendor in vendors) { 

                if (!vendors[vendor]) continue; 

                var handler = window.evidon[handlers.vendors[vendor]]; 

                if (typeof handler === 'function') handler(); 

            } 

} 
  1. Replace this section of code:
             for (var category in categories) { 
    
                    if (!categories[category]) continue; 
    
                    var handler = window.evidon[handlers.categories[category]]; 
    
                    if (typeof handler === 'function') handler(); 
    
                } 
    
                for (var vendor in vendors) { 
    
                    if (!vendors[vendor]) continue; 
    
                    var handler = window.evidon[handlers.vendors[vendor]]; 
    
                    if (typeof handler === 'function') handler(); 
    
                } 
    With the following code:
    for (var category in categories) { 
    
        if (!categories[category]) continue; 
    
        if (category === 'all') { 
    
            for (var callback in handlers.categories) { 
    
                var handler = window.evidon[handlers.categories[callback]]; 
    
                if (typeof handler === 'function') handler(); 
    
            } 
    
        } 
    
        else { 
    
            var handler = window.evidon[handlers.categories[category]]; 
    
            if (typeof handler === 'function') handler(); 
    
        } 
    
    } 


  2. For each category you wish to wrap a tag in, add a call to that specific category immediately after that portion of the code. Each category call should be written out as:

    window.evidon.handleCategoryName=function(){}

    For example, to wrap generic Adobe and Google Analytics tags in Analytics, you would add the following code to the tag immediately after the close of the priorConsentCallback function:
    window.evidon.handleAnalyticsProvider = function () { 
    
    append('adobe-launch', '//assets.adobedtm.com/5a145ff23b21/77810d5fcf25/launch-83aaf8e6dc42-development.min.js'); 
    
    append(0, 'https://www.googletagmanager.com/gtag/js?id=UA-120802170-1'); 
    
                    window.dataLayer = window.dataLayer || []; 
    
                    function gtag(){dataLayer.push(arguments);} 
    
                    gtag('js', new Date()); 
    
                    gtag('config', 'UA-120802170-1'); 
    
    } 
    The tag is wrapped inside of window.evidon.handleAnalyticsProvider so that it will fire only when the Analytics Provider toggle is triggeredIt will also fire when general consent is granted or when all vendors are enabled or turned off.

     
    Follow this process for every category you have tags in within your notice, making a category level specific handler and then wrapping the appropriate tags within those functions. 

    The full result will look like the following:

          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. 
    
                var handlers = { 
    
                    categories: { 
    
                        'all': 'handleAllCategories', 
    
                        'ad network': 'handleAdNetwork', 
    
                        'ad server': 'handleAdServer', 
    
                        'ad verification': 'handleAdVerification', 
    
                        'agency': 'handleAgency', 
    
                        'analytics provider': 'handleAnalyticsProvider', 
    
                        'business intelligence': 'handleBusinessIntelligence', 
    
    }, 
    
                    vendors: {} 
    
                }; 
    
    for (var category in categories) { 
    
        if (!categories[category]) continue; 
    
        if (category === 'all') { 
    
            for (var callback in handlers.categories) { 
    
                var handler = window.evidon[handlers.categories[callback]]; 
    
                if (typeof handler === 'function') handler(); 
    
            } 
    
        } 
    
        else { 
    
            var handler = window.evidon[handlers.categories[category]]; 
    
            if (typeof handler === 'function') handler(); 
    
        } 
    
    }			 
    
    } 
    
    window.evidon.handleAnalyticsProvider = function () { 
    
    append('adobe-launch', '//assets.adobedtm.com/5a145ff23b21/77810d5fcf25/launch-83aaf8e6dc42-development.min.js'); 
    
    append(0, 'https://www.googletagmanager.com/gtag/js?id=UA-120802170-1'); 
    
                    window.dataLayer = window.dataLayer || []; 
    
                    function gtag(){dataLayer.push(arguments);} 
    
                    gtag('js', new Date()); 
    
                    gtag('config', 'UA-120802170-1'); 
    
    } 

Vendor level tag wrapping

For the vendor level tag, the priorConsentCallback will look something like this, though the vendor names will differ based upon the vendors you have in your account:

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. 

            var handlers = { 

                categories: {}, 

                vendors: { 

                    'addtocalendar': 'handleAddToCalendar', 

                    'addvalue-dot-de': 'handleAddValuede', 

                    'addynamics': 'handleAdDynamics', 

                    'adelphic': 'handleAdelphic', 

                    'adfalcon': 'handleAdFalcon', 

                    'adform': 'handleAdform', 

                    'adgear': 'handleAdGear', 

                    'adgoto': 'handleADGoto', 

                    'adition-technologies-ag': 'handleAditionTechnologiesAG', 

                    'adkontekst': 'handleAdkontekst', 

                    'adloox': 'handleAdloox', 

                    'adman': 'handleADMAN', 

                    'ad-man-media': 'handleAdManMedia', 

                    'admans': 'handleAdmans', 

                    'admantx': 'handleADMantx', 

                    'admixer': 'handleADMIXER', 

                    'admized': 'handleADMIZED', 

                    'admob-google': 'handleAdMobGoogle', 

                    'adnetworkpro': 'handleADNETWORKPRO', 

                    'adobe': 'handleAdobe', 

     'google-analytics': 'handleGoogleAnalytics', 

} 

            }; 

            for (var category in categories) { 

                if (!categories[category]) continue; 

                var handler = window.evidon[handlers.categories[category]]; 

                if (typeof handler === 'function') handler(); 

            } 

            for (var vendor in vendors) { 

                if (!vendors[vendor]) continue; 

                var handler = window.evidon[handlers.vendors[vendor]]; 

                if (typeof handler === 'function') handler(); 

            } 

        } 
  1. Replace this section of code:
                for (var category in categories) { 
    
                    if (!categories[category]) continue; 
    
                    var handler = window.evidon[handlers.categories[category]]; 
    
                    if (typeof handler === 'function') handler(); 
    
                } 
    
                for (var vendor in vendors) { 
    
                    if (!vendors[vendor]) continue; 
    
                    var handler = window.evidon[handlers.vendors[vendor]]; 
    
                    if (typeof handler === 'function') handler(); 
    
                } ​

    With the following code:

    for (var vendor in vendors) { 
    
                   if (!vendors[vendor]) continue; 
    
    if (vendor === 'all') { 
    
    for (var callback in handlers.vendors) { 
    
    var handler = window.evidon[handlers.vendors[callback]]; 
    
    if (typeof handler === 'function') handler(); 
    
    } 
    
    } 
    
    else { 
    
    var handler = window.evidon[handlers.vendors[vendor]]; 
    
    if (typeof handler === 'function') handler(); 
    
    } 
    
    }


  2. For each vendor you wish to wrap a tag in, you will add a call to that specific vendor immediately after that portion of the code. Each vendor call should be written out as:

    window.evidon.handleVendorName = function(){}

    For example, to wrap generic Adobe and Google Analytics tags under their respective vendor names, add the following code to the tag immediately after the close of the priorConsentCallback function:

    window.evidon.handleAdobe = function () { 
    
    append('adobe-launch', '//assets.adobedtm.com/5a145ff23b21/77810d5fcf25/launch-83aaf8e6dc42-development.min.js'); 
    
    } 
    
    window.evidon.handleGoogleAnalytics = function () { 
    
    append(0, 'https://www.googletagmanager.com/gtag/js?id=UA-120802170-1'); 
    
                    window.dataLayer = window.dataLayer || []; 
    
                    function gtag(){dataLayer.push(arguments);} 
    
                    gtag('js', new Date()); 
    
                    gtag('config', 'UA-120802170-1'); 
    
    } ​

    The tags are wrapped in window.evidon.handleAdobe and window.evidon.handleGoogleAnalytics so that they will fire only when the Adobe toggle is triggered. They will also fire when general consent is granted or when all vendors are enabled or turned off. 

    Follow this process for for every vendor on your notice that you wish to wrap in consent by making a vendor level specific handler and then wrapping the appropriate tags within those functions.   

    The full result will look like this:

    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. 
    
                var handlers = { 
    
                    categories: {}, 
    
                    vendors: { 
    
                        'addtocalendar': 'handleAddToCalendar', 
    
                        'addvalue-dot-de': 'handleAddValuede', 
    
                        'addynamics': 'handleAdDynamics', 
    
                        'adelphic': 'handleAdelphic', 
    
                        'adfalcon': 'handleAdFalcon', 
    
                        'adform': 'handleAdform', 
    
                        'adgear': 'handleAdGear', 
    
                        'adgoto': 'handleADGoto', 
    
                        'adition-technologies-ag': 'handleAditionTechnologiesAG', 
    
                        'adkontekst': 'handleAdkontekst', 
    
                        'adloox': 'handleAdloox', 
    
                        'adman': 'handleADMAN', 
    
                        'ad-man-media': 'handleAdManMedia', 
    
                        'admaxim': 'handleAdMaxim', 
    
                        'admixer': 'handleADMIXER', 
    
                        'admized': 'handleADMIZED', 
    
                        'admob-google': 'handleAdMobGoogle', 
    
                        'adnetworkpro': 'handleADNETWORKPRO', 
    
                        'adobe': 'handleAdobe', 
    
         'google-analytics': 'handleGoogleAnalytics', 
    
    } 
    
                }; 
    
     
    
    for (var vendor in vendors) { 
    
                   if (!vendors[vendor]) continue; 
    
    if (vendor === 'all') { 
    
    for (var callback in handlers.vendors) { 
    
    var handler = window.evidon[handlers.vendors[callback]]; 
    
    if (typeof handler === 'function') handler(); 
    
    } 
    
    } 
    
    else { 
    
    var handler = window.evidon[handlers.vendors[vendor]]; 
    
    if (typeof handler === 'function') handler(); 
    
    } 
    
    }         
    
    } 
    
    window.evidon.handleAdobe = function () { 
    
    append('adobe-launch', '//assets.adobedtm.com/5a145ff23b21/77810d5fcf25/launch-83aaf8e6dc42-development.min.js'); 
    
    } 
    
    window.evidon.handleGoogleAnalytics = function () { 
    
    append(0, 'https://www.googletagmanager.com/gtag/js?id=UA-120802170-1'); 
    
                    window.dataLayer = window.dataLayer || []; 
    
                    function gtag(){dataLayer.push(arguments);} 
    
                    gtag('js', new Date()); 
    
                    gtag('config', 'UA-120802170-1'); 
    
    } 

     

Labels (1)

Can't find what you are looking for?

Find Answers

Search our DG Forum to find answers to questions asked by other DG users.

Ask a Question

No luck? Ask a question. Our Product and Support teams are monitoring the Forum and typically respond within 48 hours.

Ask a Question