Add tracking codes everytime there is a new page

To add tracking codes every time there is a new page, you can use a programming language like JavaScript to dynamically inject the tracking code into the HTML of each page.

Here's an example of how you can do this using JavaScript:

// Get the current page URL
var currentPageUrl = window.location.href;

// Add the tracking code to the page
function addTrackingCode() {
  // Replace "YOUR_TRACKING_CODE_HERE" with your actual tracking code
  var trackingCode = '<script>YOUR_TRACKING_CODE_HERE</script>';
  var head = document.head || document.getElementsByTagName('head')[0];
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.innerHTML = trackingCode;
  head.appendChild(script);
}

// Call the function every time the page changes
window.addEventListener('load', addTrackingCode);
window.addEventListener('pageshow', addTrackingCode);

This code uses the window.location.href property to get the current page URL, and then uses the addTrackingCode function to add the tracking code to the page. The addTrackingCode function creates a new <script> element and sets its innerHTML property to the tracking code. It then appends the script element to the <head> of the document using the appendChild method.

The window.addEventListener method is used to attach the addTrackingCode function to the load and pageshow events. The load event is fired when the page finishes loading, and the pageshow event is fired when the page is shown (i.e., when the user navigates to a new page).

You can also use a library like jQuery to make the code more concise:

$(document).ready(function() {
  var trackingCode = '<script>YOUR_TRACKING_CODE_HERE</script>';
  $('head').append('<script>' + trackingCode + '</script>');
});

This code uses the $(document).ready method to wait for the document to be ready, and then uses the append method to add the tracking code to the <head> of the document.

Note that you should replace YOUR_TRACKING_CODE_HERE with your actual tracking code.