F5 Sites
  • F5.com
  • LearnF5
  • NGINX
  • MyF5
  • Partner Central
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
Groups
EventsSuggestionsHow Do I...?
RegisterSign In
  1. DevCentral
  2. CrowdSRC
  3. CodeShare

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.0
application delivery
BIG-IP Access Policy Manager (APM)
iRules
security
Yann_Desmarest's avatar
Yann_Desmarest
Icon for Cirrus rankCirrus
Joined September 11, 2012
View Profile
Seth_Cooper's avatar
Seth_Cooper
Icon for Employee rankEmployee
Jun 10, 2021

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();
    }
};

ABOUT DEVCENTRAL

DevCentral NewsTechnical ForumTechnical ArticlesTechnical CrowdSRCCommunity GuidelinesDevCentral EULAGet a Developer Lab LicenseBecome a DevCentral MVP

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesF5 CertificationLearnF5 Training

SUPPORT

Manage SubscriptionsProfessional ServicesProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

F5 logo©2024 F5, Inc. All rights reserved.
TrademarksPoliciesPrivacyCalifornia PrivacyDo Not Sell My Personal Information