Key Word Search
Summary
This ObservePoint Custom Tag allows you to search for key words and flag pages where those key words are found. Using the javascript snippet below in the Audit Actions configuration will fire a tag that collects your key words, as variables with the value of true/false if that key word is present.
Note: The key word search is case agnostic, so it will identify lowercase and uppercase variants of the key words.
You will need to modify this Javascript by defining the key words you want to search for in the array.
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)); } //add key words to this array let words = ["Insert key Word 1", "Insert key Word 2", "Insert key Word 2"]; let obj = {}; //don't touch this let dom = document.documentElement.innerText.toLowerCase(); //don't touch this words.forEach((word) => { if (dom.includes(word.toLowerCase())) { obj[word.toLowerCase()] = true; } else { obj[word.toLowerCase()] = false; } }) opReqGetAsync(obj, 'Key Word Search');