How to use JS or Jq to track the clicks on the link, which is in a certain class?


I need to track link clicks for Google Analytics. The idea is that you can use onclick on the link, but in this case it is impossible, as there is a block of a constructor, which does not allow to modify it. I can only put in a hat for a script that will keep track of clicking on the link within a class.

Usually always found a solution using onclick but now stuck with this site Builder((((
March 23rd 20 at 19:16
1 answer
March 23rd 20 at 19:18
Class references either. But data elementu to cling can.
$('a[data-cke-saved-href="tel:+77771256606"]').on('click', function() { 

Or just href:
$('[href="tel:+77771256606"]').on('click', function() { 

Well, you can use the class of the parent element:
$('.btn_descr a').on('click', function() { 
All phones:

$('a[href^="tel:"]')... - joe.Schroeder commented on March 23rd 20 at 19:21

Find more questions by tags jQueryJavaScript