OP Custom Tag - Checking the Privacy Policy Link

Overview

An important aspect of many Data Privacy laws is the requirement for the privacy policy to be easily accessible from any page on the website. You can check your site for any pages missing the privacy policy link.

Follow these steps to set up an Audit to look for the privacy policy link on each page of the Audit:

  1. Create a simple Audit to scan pages on your site
  2. Create an On-page action with an execute action type and paste in the following code:
    //add a CSS Selector to match your privacy policy link e.g. [href*='privacy-policy']
    
    let cssSelector = "INSERT CSS SELECTOR HERE";
    let tagAccountName = 'Privacy Policy Check';
    
    /////////////////////////////////////////////////////////////////////////////////
                    /*       DON'T MODIFY ANYTHING BELOW         */
    /////////////////////////////////////////////////////////////////////////////////
    
    let obj = {};
    obj['privacyPolicyPresent'] = ([...document.querySelectorAll(cssSelector)].length > 0) ? true : false;
    opReqGetAsync(obj, tagAccountName);
    
    function opReqGetAsync(paramObject, acct, callback) {
        var baseURL = window.location.protocol + "//" + window.location.hostname + "/observepointcustomtag?acct=" + acct;
        var opReq = new XMLHttpRequest();
        opReq.onreadystatechange = function () {
            if (opReq.readyState === 4 && opReq.status === 200) {
                callback(opReq.responseText);
            }
        }
        opReq.open("POST", baseURL, true);
        opReq.send(JSON.stringify(paramObject));
    }
    	
  3. Modify the code "INSERT CSS SELECTOR HERE" line with your own CSS selector to identify the privacy link on your site.
  4. Set the action to run on every page.
  5. Save and run the Audit.

Once an Audit run is complete, you can go into the Variable Inventory to view the results of this script. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us