APM - Track clicks on webtop resources
Problem this snippet solves: This configuration sample provide to the administrator a way to log all APM webtop resources clicked by a logged-in user. Those logs can be exported to external systems ...
Updated Jun 06, 2023
Version 2.0Yann_Desmarest
Cirrus
Joined September 11, 2012
brad_11480
Sep 19, 2018Nimbostratus
Well close.. Still didn't seem to be hitting 100%. But the following modification seems to be working much better..
window.onclick = function (e) {
if (e.target.parentNode.className == "favorite" || e.target.parentNode.className == "image" || e.target.parentNode.className == "caption") {
var xhttp = new XMLHttpRequest();
console.log(e.target.parentNode.id);
var parentNodeId = "";
//populate parent's parent
if (e.target.parentNode.parentNode.id) {
parentNodeId = e.target.parentNode.parentNode.id;
}
//overwrite parent's parent if parent not null
if (e.target.parentNode.id) {
parentNodeId = e.target.parentNode.id;
}
//open link
if (parentNodeId) {
var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(parentNodeId)) + "&d=" + Date.now();
xhttp.open("GET", uri, true);
xhttp.send();
}
//log failed result
else {
console.log("Parent ID is NULL");
}
}
};