01 March, 2007

Hooking Up SubText Blog with Google Analytics

This blog is running SubText as blog engine. It works great, the biggest thing I’m missing is stats. I don’t have many readers but it’s fun to know just how few they are. So first step in this was to let FeedBurner handle the distribution of my RSS feed and get some simple stats on that.

The next step was to get some stats on the actual blog. I signed up for Google Analytics when they first released it for testing, but haven’t used it much since. Now I thought why not put it to the test. To get it collecting data from subtext, here’s what I did.

First of all, I got a hold of the JavaScript snippet that does the actual collecting. So I hit www.google.com/analytics, logged in and navigated to Profile Settings -> Tracking Status.

wpid GoogleAnalytics 01 JavaScript3

Copied the JavaScript snippet to the clipboard. Next thing I did was find the file where the script should be inserted, the PageTemplate.ascx file. It’s located in <SubText web root>\Skins\<Your skin of choice>. For example: C:\Inetpub\wwwroot\SubText\Skins\RedBook\PageTemplate.ascx. Open that up in a editor of your choice, and paste the JavaScript. Should look something like this when you’re done.

wpid GoogleAnalytics 02 Insert JavaScript2

Save and you’re set to go. Mind that the data collection may take a couple of hours to get started, so have a good nights sleep and check back with Google Analytics tomorrow.

A few notes about this. Doing this does not include admin pages in the statistics, wich is the way I want it. When upgrading subtext to new versions you have to merge in this customization manually.

Tags: , ,