Skip to main content
All CollectionsObservePoint Custom Tag
OP Custom Tag - Tag Performance
OP Custom Tag - Tag Performance
Luiza Gircoveanu avatar
Written by Luiza Gircoveanu
Updated over 6 months ago

Overview

This custom tag will capture the load time of a specific tag or resource that is loaded on the page. Utilize this tag to build rules around individual tag load times. To capture multiple load times for many tags, then one instance of this script should be deployed for each tag as an execute action.

Customizing the Tag

Line 13 of the the tag is altered to input the name of the tag:

<span style="color: #800000;">'Tag-Name': 'Adobe Analytics'</span>

Line 30 of the tag is altered to enter string unique to targeted area:

<span style="color: #800000;">if(winTiming[i].name.indexOf('-- enter string unique to targeted tag here --') > 0){</span>

If you choose not to customize the tag, it will default to the first Adobe Analytics tag fired on each page.

Under Variable Summary in ObservePoint Data, select the Tag Performance account to access relevant variables.

  • Tag-Load-Time: Shows the time each tag took to load.

  • Tag-Name: Shows the tag that loaded for each URL.

To capture these details in an Audit or Journey, paste the snippet below into an Execute Action. If you choose to customize the tag, find the red text in the code below and remove, edit, or add to it.

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 object = {
'Tag-Name': 'Adobe Analytics',
}
var winTiming = window.performance.getEntriesByType('resource');
if (winTiming.length > 0) {
for (i = 0; i < winTiming.length; i++) {
if (winTiming[i].name.indexOf('b/ss') > 0) {
object['Tag-Load-Time'] = winTiming[i].duration.toFixed(0);
break;
} else {
object['Tag-Load-Time'] = "empty";
}
}
}
if (winTiming.length > 0) {
opReqGetAsync(object, ' Tag Performance');
}
Did this answer your question?