I'm a sucker for statistics (the number of people searching for "squiring girls" who end up on my site, due to my entry titled "Squirting at the London Girl Geek Dinner" and when someone showed me the fun things google analytics produce I was hooked.

Right now, however, there's no easy way to add custom code to every page on a subtext blog. Once I get my SQL installation up and running again (or bite the bullet and reinstall everything *sigh*) I hope to tackle that. So how do you go about it? Well, every subtext page, underneath the hood runs through "dtp.aspx". So in order to the script necessary for google analytics, or indeed any other stat tracking may wish to use simply edit dtp.aspx and add the gubbins, I recommend adding them outside the <form> tag.

As an aside, if you're running Firebug or other javascript utility which reports errors and you're fed up with seeing "urchinTracker is not defined" that is simple to fix (and I have no idea why the javascript google delivers to you doesn't do it);

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
<script type="text/javascript">
  _uacct = "UA-9999999-9"
  if (typeof(urchinTracker) != 'undefined')

Adding the typeof() check will only call urchinTracker if it is defined and not, for example, blocked by something like AdBlock.


Technorati tags: ,