# Google Analytics Agency | SEO Consultant | SEM Consultant ## Posts - [Append Tracking Template Automatically using Javascript](https://usmanfarooq.com/append-tracking-template-automatically-using-javascript/): Below is the piece of code that can be used to append the tracking template automatically: <script> // 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 (var i = 0; i < url.length; i++) { // Save all href attributes in a variable var sample_variable = url[i].href; // Search for unique href values containing specific string values if (sample_variable.includes("usmanfarooq.com")) { // Overwrite URL values with new values url[i].href = sample_variable + "{{custom parameter details for tracking}}"; } } </script> ## Pages - [Consulting Blog](https://usmanfarooq.com/consulting-blog/) - [Resume Home](https://usmanfarooq.com/) [comment]: # (Generated by Hostinger Tools Plugin)