APM - Track clicks on webtop resources
Updated Jun 06, 2023
Version 2.0Was this article helpful?
To make this work on Modern Customization the JavaScript needs to be changed. It will be installed in advanced customization under "Webtops" > "[webtop name]" > "user-webtop.js".
window.onclick = function(e) {
if (e.target.className == "apmui-webtop-resource") {
var tID = e.target.id;
console.log(tID);
var xhttp = new XMLHttpRequest();
var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(tID)) + "&d=" + Date.now();
xhttp.open("GET", uri, true);
xhttp.send();
}
if (e.target.parentNode.className == "apmui-webtop-resource") {
var tID = e.target.parentNode.id;
console.log(tID);
var xhttp = new XMLHttpRequest();
var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(tID)) + "&d=" + Date.now();
xhttp.open("GET", uri, true);
xhttp.send();
}
if (e.target.parentNode.parentNode.className == "apmui-webtop-resource") {
var tID = e.target.parentNode.parentNode.id;
console.log(tID);
var xhttp = new XMLHttpRequest();
var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(tID)) + "&d=" + Date.now();
xhttp.open("GET", uri, true);
xhttp.send();
}
if (e.target.parentNode.parentNode.parentNode.className == "apmui-webtop-resource") {
var tID = e.target.parentNode.parentNode.parentNode.id;
console.log(tID);
var xhttp = new XMLHttpRequest();
var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(tID)) + "&d=" + Date.now();
xhttp.open("GET", uri, true);
xhttp.send();
}
};