Get all the URL values into a custom defined variable.

var url=document.querySelectorAll(“a”);

Use a loop to read all the URL values.

for(i=0;i<url.length;i++) {

Save all href attributes in a variable
var Sample_varible = url[i].href;

Search for a unique href values containing specific string values


Overwrite URL values with new values
url[i].href = Sample_varible + “{{custom paramter details for tracking}}” ;



Feel free to get in touch If there is an issue implementing the code. You can email at me@usmanfarooq.com

Leave a comment

Your email address will not be published.