Highlighted

Click Tracking using Javascript Code is not getting executed

Rookie Contributor

I have created a Javascript code extension for capturing the some clicks on sharepoint portal using CSS selectors. The code get is working properly when executed on console but not working in extension. Below is the small code that is used in extension:

jQuery('#myHR-css p a').click(function(){
s.linkTrackVars = 'eVar16';
s.linkTrackEvents='event14';
var active_sidebar = jQuery('.pages-menu__item.analyticsTrigger.active .pages-menu__link.analyticsTrigger.active span').text();
var c = utag_data.subSection+":"+utag_data._site+":"+ active_sidebar ;
var clicktext = ($(this).text());
s.eVar16 = c+":"+clicktext;
s.events = 'event14';
s.tl(this,'o',null,'navigate');
//console.log(s.eVar16)
});