F5 Sites
  • F5.com
  • F5 Labs
  • MyF5
  • NGINX
  • Partner Central
  • Education Services Portal (ESP)
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
GroupsEventsSuggestionsHow 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 05, 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();
    }
};

Help guide the future of your DevCentral Community!

What tools do you use to collaborate? (1min - anonymous)

ABOUT DEVCENTRAL

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

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesTraining & Certification

SUPPORT

Manage SubscriptionsProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

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