Michael Henley

September 7, 2009

Using Google Analytics with MovableType 4.31

Filed under: blogging, general tech, internet — michael @ 10:39 pm

This is based heavily on Daniel Sirz’s useful piece for using Analytics with MT which can be found here. I found that it was missing one or two little bits which had me scratching my head for a while and so have rewritten it for the most current version of MT. This will include the Analytics code into the header template, so that it is included in every page of the blog.

Ensure that you are managing the blog, and not the global MT install. From the Dashboard, navigate to the Templates section:

Scroll down to the Template Modules section, and select Create Template Module:

Copy your Analytics tracking code from their website, and then create a new module called ‘Google Analytics’:

Save your changes, and then navigate back to the templates by clicking ‘List all templates’

Click the HTML Head Template to edit it:

Click the line below the last one currently present, and enter:

<$mt:Include module="Google Analytics"$>

Once you save, you should see this:

Head back to the main screen by again clicking ‘List all templates’. The final step is to rebuild your blog to include the new code. To do this, click the ‘Publish Blog’ button in the cross bar:

Tell it to Publish all files, and then wait while it rebuilds. When it is done you will see a box telling you that it is complete and how long it has taken. If you now go to any page on your blog and check its source, you will see that the analytics code is being included in the header and so will report back the stats.


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress