Creating a Custom Clicked Element by Link Extension


We have hundreds of eCommerce product pages with different types (.pdf, .skp, .doc, .dwg, etc.) of support documentation on each. I want to set up link click event tracking to track when each type of a file is downloaded. 


I'm trying to follow this documentation:


Tracking by ID and Class is too broad. I believe/hope I can do it using a jQuery selector. I just don't know what I need to enter as the jQuery selector when setting this up in HubSpot to track the links properly. Can I track by something along the lines of link contains .dwg and what would I use?

Would this be what I use: a[href$=".pdf"] to rack .pdf link clinks? 


Note: These pages and files are not hosted on HubSpot, but HubSpot tracking is on the page. 


Here is an example of the code for the link.

<a href="" target="_blank" title="CAD">
UX238-LB (DWG) </a>



1 Reply 1
HubSpot Employee

Hi, @madraxsam.


Apologies for the delayed response.


Yes, you're right on track! This selector worked for me:


jQuery Selector.jpg

Isaac Takushi

Associate Certification Manager