Sometimes I work on other people's plugins. The last couple of evenings I made some changes to Terence J. Grant's Google Analytics Plugin.

Google Analytics is a very popular website statistics tool and many people want to integrate it withe their DokuWiki installs. It's a recurring question on the DokuWiki user forum.

To just integrate it, you strictly don't even need a plugin. You could just add Google's JavaScript code in one of the template include hooks and be done with it. The plugin made that just a tiny bit easier and gave some additional config options.

However by default, that will only log page views based on the URL. It's okay, but if you want to have a little more insight in what's going on, it would be helpful to add some wiki specifics to Google Analytics . And besides some refactoring that's exactly what I did.

The plugin now sends DokuWiki actions (like show, revisions, edit, etc) as "custom dimensions" to Google Analytics. This means you can figure out exactly how often a page was viewed and how often it was edited for example.

The plugin also normalizes the page ids to a format that Google Analytics understands, so you can easily aggregate pageviews over a certain namespace for example - and that's independent from any URL altering settings like userewrite or useslash you might be using. Finally it's now easily possible to let Google Analytics analyze the search queries people use in DokuWiki's internal search.

My changes have already been merged upstream, so you can just install the plugin and have all the new features available.

I'm thinking about adding tracking for certain events happening inside DokuWiki later on, but for now I'm happy with the changes...