Specific Top JavaScript Files

Overview

This custom tag will capture hard coded JavaScript files for the following vendors:

  • Adobe Target
  • Adobe Analytics
  • Akamai
  • Google Universal Analytics

Under Variable Summary in the ObservePoint Data tag, select the Specific Top JS Files account to see the relevant variables. In the code snippet below, change the name of hardcodeSearch highlighted in red according to your needs.

  • hardcode_found: Shows number of scripts found.
  • hardcode_(name of tag vendor)_scripts: Shows the script for the URLs with hardcoded scripts.
  • hardcode_(name of tag vendor)_scripts.0: Shows the JavaScript file associated with each URL.
  • hardcode_(name of tag vendor)_scripts.length: Shows the number of hardcode scripts on each URL.
  • Page: Shows the URL for each page.
  • visitorAPIversion: Shows the API version of the visitor for each URL.

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)); 
} 
myInfo = { 
Page: document.URL, 
hardcode_Target_found: document.querySelectorAll('[src*="mbox.js"]').length, 
hardcode_SOASTA_found: document.querySelectorAll('[src*="boomerang/config.js"]').length, 
hardcode_AA_found: document.querySelectorAll('[src*="s_code.js"],[src*="VisitorAPI.js"],[src*="AppMeasurement.js"]').length, 
hardcode_GA_found: document.querySelectorAll('script[src*="google-analytics.com/ga.js"]').length, 
hardcode_GUA_found: document.querySelectorAll('script[src*="google-analytics.com/analytics.js"]').length, 
}; 
try {myInfo.visitorAPIversion = visitor.version;} catch(err) {myInfo.visitorAPIversion = "not found";} 
try {myInfo.hardcode_Target_scripts = $('[src*="mbox.js"]').map(function(){return $(this).attr("src");}).get();} catch(err) {myInfo.hardcode_Target_scripts = "none";} 
try {myInfo.hardcode_SOASTA_scripts = $('[src*="boomerang/config.js"]').map(function(){return $(this).attr("src");}).get();} catch(err) {myInfo.hardcode_SOASTA_scripts = "none";} 
try {myInfo.hardcode_AA_scripts = $('[src*="s_code.js"],[src*="VisitorAPI.js"],[src*="AppMeasurement.js"]').map(function(){return $(this).attr("src");}).get();} catch(err) {myInfo.hardcode_AA_scripts = "none";} 
try {myInfo.hardcode_GA_scripts = $('script[src*="google-analytics.com/ga.js"]').map(function(){return $(this).attr("src");}).get();} catch(err) {myInfo.hardcode_GA_scripts = "none";} 
try {myInfo.hardcode_GUA_scripts = $('script[src*="google-analytics.com/analytics.js"]').map(function(){return $(this).attr("src");}).get();} catch(err) {myInfo.hardcode_GUA_scripts = "none";} 
opReqGetAsync(myInfo, " Specific Top JS Files");
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.