Several years ago, in response to a discussion here, Shaun suggested adding our Google Analytics javascript to the Mint auto.php file so that, like Mint, we wouldn’t have to install the GA javascript on every page.
It has worked like a charm. Our Google and Mint stats, though not exactly the same, are close enough to act like a “backup” system for each other.
When I recently upgraded to Mint 2.17 on April 23 I forgot to replace the auto.php with my modified version and for the past week I lost all my GA stats. When I went to manually reinsert the Google code today (instead of replacing the auto.php with my old modified file) I discovered two things:
The Mint 2.17 auto.php file appears slightly different than the old one I had been using (not sure how old it is).
Google has an updated javascript they want us to use. The Google change was first offered years ago but because everything was working ok, we ignored the Google update.
I’m trying to determine if indeed, the auto.php file changed slightly in one of the 2.x updates. I installed the old Google javascript into the 2.17 auto.php file and Mint works. I’ll need another day to see if Google is tracking correctly.
I’m also wondering if I can insert the new Google code into the same place — the new code is much longer. Though I’m not a programmer, it seems to me that I should be able to remove the line breaks in the script and place it like before (Shaun originally said the Google javascript must be all on one line).
The old Google script, with line breaks removed by me, looks like this:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">_uacct = "UA-000000-1";urchinTracker();</script>
The new script, with line breaks removed by me, looks like this:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script> <script type="text/javascript"> try {var pageTracker = _gat._getTracker("UA-000000-1"); pageTracker._trackPageview();} catch(err) {}</script>