OP Custom Tag Template

Overview

The OP Custom tag pulls data into ObservePoint Audits and Journeys, making it accessible to validate with rules. If you can find it in the dev console then it can be created into an OP customer tag. The OP customer tag is just javascript executed after the page loads.  

Use Cases

The tags themselves are completely custom and can be used for a variety of use cases including:

  • Scraping HTML for keywords (e.g. rebranding, checking for consent manager links, searching for videos or images, finding JS files, SEO data, etc.)
  • Looking at custom objects in the console (e.g. data layer objects, event listeners, etc.)
  • Other browser attributes (e.g. 1st party cookies, browser width, user agents, etc.)

General Setup

You'll want to determine your specific use case, make sure you can find that info inside of the dev console, then following the underlined method in the Template photo, write out javascript to pull that information. Once your code has been tested, copy and paste the template into ObservePoint Actions, replace the underlined code with your code, add any necessary regex, then save and run the audit.  

This is what it should look like after pasting it into ObservePoint Actions: After following the underlined method, replace your code with the underlined code.

Template

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));
}
////////////////////////////////////////////////// Above is script that fires the OP Custom Tag, you should NOT modify it /////////////////////////////////////////////////////

//The Javascript object below is what you will build, apply to an Audit or Journey, and capture in the ObservePoint Data tag.
var obj = {};

obj['Variable Name goes here'] = 'value goes here'; //Here you fill the object with key-value pairs, repeat as many times as you need

//this tells your tag to fire and gives it the account name of your choice.
let tagAccountName = 'ACCOUNT NAME GOES HERE' opReqGetAsync(obj, tagAccountName);

Out of the Box

We have created a lot of custom tags and want you to leverage them for your objectives. Here is a guide with all of the ones we have already built.

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