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
Yann_Desmarest's avatar
Yann_Desmarest
Icon for Cirrus rankCirrus
Sep 18, 2018

Hi Brad,

 

I have done several tests using all kind of available resources on the webtop and I'm able to log everything. I found that when someone click on the icon of the resource and not the text, the script fails. So I added a piece of code to handle this case :

 

if (e.target.parentNode.className == "image" && e.target.parentNode.parentNode.className == "favorite") {
    var xhttp = new XMLHttpRequest();
    console.log(e.target.parentNode.id);
    var uri = "/analytics?t=" + Math.random() + "&r=" + encodeURIComponent(window.btoa(e.target.parentNode.parentNode.id)) + "&d=" + Date.now();
    xhttp.open("GET", uri, true);
    xhttp.send();
}

In fact, the class of all icons is image, not favorite. So I check the parent element of the parent of the icon.

 

I tested again and now it looks like it matches 100% of clicks. Let me know if it works fine for you.

 

Have a nice day

 

Yann

 

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