I\'m changing a big section of a website to use jQuery Address\' deep linking AJAX features. I\'m using URIs like mysite.com/#!/page1/subpage/
and so on.
I use a system that involves requesting the html as plain text, parsing the html first to change all script tags into divs, detach those divs, append the page, then loop through the divs (that are actually scripts) and append their contents to script tags or create script tags with the src on that div. It is very similar to how the history.js framework example does it.
$.get(urlToLoad).promise().done(function(html) {
var outHTML = html;
outHTML = outHTML.replace(/
using this method, you could add the script that does the tracking on each page. I personally prefer to do it on the global page in a way similar to how Jasper suggested.