javascript - Implementing multiple link tracking -


in adobe analytics liniking tracking using this

<a href="http://www.google.com/" onclick="s.tl(this,'e','google', null,'navigate');return false"> test </a> 

if have many links in code , want make same of them how possible use 1 fuction onclick event links have in code?

this should work native javascript, without external library needed

var links = document.links;  for(var = 0; < links.length; i++) {   links[i].addeventlistener('click', function(e) {     e.preventdefault();     s.tl(this,'e','google', null,'navigate');return false   }); } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -