Skip to main content
OP Custom Tag - Template
Luiza Gircoveanu avatar
Written by Luiza Gircoveanu
Updated over 3 months ago

Overview

The ObservePoint 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 captured in an ObservePoint Custom Tag. The ObservePoint Custom Tag is just JavaScript executed after the page loads. The data is visible in reports under the ObservePoint Data tag.

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 On-Page Actions as an Execute Action Type, 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 On-Page Actions:

Template

// The JavaScript object below is what you will build, apply to an Audit or Journey, and capture in the ObservePoint Data tag.
var obj = {};
// Here you fill the object with key-value pairs, repeat as many times as you need
obj['Variable Name goes here'] = 'value goes here';
// This tells your tag to fire and gives it the account name of your choice. Provide whatever value here that you want.
var tagAccountName = 'ACCOUNT NAME GOES HERE';
// Below is script that fires the OP Custom Tag, you should NOT modify it
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));
}
opReqGetAsync(obj, tagAccountName);

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?