Collecting Network Request URLs

Overview

This custom tag collects all the network requests made on the page.

Under Variable Summary in ObservePoint Data, select the Other Network Urls account to see the relevant variables.

  • 0-xx: Shows the source of where URL links are generated and the subsequent URL.
  • length: Shows the number of links found by page.

To capture these details in an audit or web journey, paste the snippet below into an Execute Action:

function opReqGetAsync(paramObject, acct, callback) { 
var baseURL = "https://opreq.observepoint.com/?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)); 
}
var arr = window.performance.getEntries(); var resultArr = []; for (var i = arr.length - 1; i >= 0; i--) { if(arr[i].name.indexOf('http') === 0) resultArr.push(arr[i].name) };
opReqGetAsync(resultArr, " Network Urls");
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.