Customize Cookie Consent

Summary

PathFactory is able to integrate with external cookie consent providers. These may be custom solutions built by your organization, or a cookie consent provider you have purchased.

How does this work?

PathFactory allows 3rd party cookie consent providers to manage the PathFactory vid persistent cookie on a Content Track by providing a set of functions that can be executed within a Content Track. Working in conjunction with the scripts from your consent provider, these functions can determine the current status of cookie consent of a visitor and set the consent status of a visitor.

Note
Don’t have an external cookie consent provider? Use PathFactory’s built-in cookie consent function!

  1. Select Organization Settings from the drop-down menu under your username.
    Note
    You must be an admin user to access Organization Settings.
    Organization Settings menu item
    Organization Settings menu item
  2. Click the Cookie Consent tab, then select Cookie Consent managed by external cookie consent manager.
    Cookie Consent External Manager
    Cookie Consent External Manager
  3. In the text box that appears, enter scripts from your consent provider in conjunction with PathFactory consent functions.
    Note
    See the Code Samples below on how to use setPfConsent() and pfConsentStatus() with a 3rd party consent provider.

    imageCode Example

  4. (Optional) Check Enable for newly created items.
    Note
    This ensures that all new Content Tracks created after this point will automatically have Cookie Consent toggled on. If you do not select this option, you will have to manually toggle on Cookie Consent for individual Content Track.
    Enable Cookie Consent for newly created items
    Enable Cookie Consent for newly created items

Code Sample: Generic Implementation

If you are using a custom cookie consent implementation on your website, you can use the function below to interact with PathFactory’s consent settings.
Your consent provider scripts should request tracking consent from the visitor and pass the result to the setPfConsent function.

//Add the script for your consent provider here

function setPfConsent(status){
if(pfConsentStatus()!=true &&status==true)
    return pfCookieResponse(true);
if (pfConsentStatus() != false && status==false)
    pfCookieResponse(false);
}

pfOnJukeboxLoad.then(function() {

//run consent functions here.
If your consent manager returns true,
run setPfConsent(true), 
if it returns false, run setPfConsent(false) });

Code Sample: TrustArc Implementation

The TrustArc script contains 2 parts.
First, PathFactory checks consent from TrustArc when the Content Track loads.
PathFactory then adds a listener to check again if a visitor updates their preferences in TrustArc on the Content Track.
We are getting the visitor’s consent status from the notice_gdpr_prefs cookie dropped by TrustArc.

Add the following scripts to the text area in the Cookie Consent configuration section:

<script async="async" type="text/javascript" src='//consent.truste.com/notice?domain=YOURDOMAIN.com&c=teconsent&text=true'; crossorigin></script>

<script>
//Level of consent required: 0=required, 1=functional, 2=advertising
var cookieCategory = 2;

function getCookie(cname) {
  var name = cname + "=";
  var decodedCookie = decodeURIComponent(document.cookie);
  var ca = decodedCookie.split(';');
  for(var i = 0; i <ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}

function setPfConsent(status){
if(pfConsentStatus()!=true &&status==true)
    return pfCookieResponse(true);
if (pfConsentStatus() != false && status==false)
    pfCookieResponse(false);
}


pfOnJukeboxLoad.then(function() {
  setPfConsent(getCookie("notice_gdpr_prefs").indexOf(cookieCategory)>=0);
});
//Register with the API for automatic updates of user preferences (for the settings you care about)
//--OR-- if the API is loading, then this will send an update when the API is done and has loaded the user preferences.
      window.addEventListener("message", function(e){
          try{
            var json = JSON.parse(e.data);
                        if (json.source=="preference_manager"&&json.message=="submit_preferences"){
                      setPfConsent(getCookie("notice_gdpr_prefs").indexOf(cookieCategory)>=0)
           }
           }catch(e){}
           }, false);
  </script>

Code Sample: CookiePro Implementation

The CookiePro script dynamically updates script tags in the HTML tied to the different cookie categories. Simply add the script tag below along with the CookiePro banner script. When the visitor has consented to being tracked, the script tag’s type will change from text/plain to JavaScript and the PathFactory opt-in will execute.

Add the following scripts to the text area in the Cookie Consent configuration section:

<script type="text/plain" class="optanon-category-2">

pfOnJukeboxLoad.then(function() {
if(pfConsentStatus()!=true)
 pfCookieResponse(true);
});
</script>

In order for these cookie consent scripts to execute, an Experience must have Cookie Consent toggled On.

Cookie Consent toggle
Cookie Consent toggle

How to Customize Cookie Consent Menu Appearance 

Note: While the Cookie Settings menu appears in all Classic and Templated Experiences, you may alter its appearance only in Classic Experiences. 

After your visitor has accepted cookies, they are given tracking options on a Cookie Settings menu, an example of which is highlighted in the screen capture below.

Cookie Settings menu example
Cookie Settings menu example

When the visitor clicks on the Cookie Settings gear icon, a menu appears so that they can personalize the tracking settings.

Cookie Preferences
Cookie Preferences

To modify the appearance of this menu in terms of colors and styling, follow these steps.

  1. On the main navigation menu, click the gear icon and then select Appearances.
    Appearances menu item
    Appearances menu item
  2. In the Appearances Configuration menu that opens, select the Cookie Consent tab.
    Appearances for Cookie Consent menu
    Appearances for Cookie Consent menu
  3. Use the edit menus to set the fonts and colors for the Cookie Consent Settings menu and the Cookie Preference Center.
  4. When you have finished your edits, you can lock in the changes by clicking Save Cookie Consent Settings. To exit without saving, click Reset Settings.

 

How to Customize Cookie Consent Menu Appearance for Templated Experiences

To edit the appearance of a cookie consent message for a Templated Experience, you must edit its associated Theme file.

For more information on how to customize a Theme file, read How to Create/Configure a Theme File.

Views: 63

Updated on March 20, 2024

Was this article helpful?

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
CONTACT SUPPORT