Extension:Google Analytics

Analytics is a simple extension which allows you to put a Google Analytics tracker in your MediaWiki articles, so you can obtain statistics on the articles that you are interested in.

Usage


Source code
Source code of "extensions/analytics.php": 


 * 1) To install it put this file in the extensions directory
 * 2) To activate the extension, include it from your LocalSettings.php
 * 3) with: require("extensions/analytics.php");

$wgExtensionFunctions[] = "wfAnalytics";

function wfAnalytics { global $wgParser; # registers the extension with the WikiText parser $wgParser->setHook( "analytics", "renderAnalytics" ); }

function renderAnalytics( $input, $argv ) { $output = ''; $output .= ' '; $output .= ''; $output .= '_uacct = "'.$argv["uacct"].'";'; $output .= 'urchinTracker;'; $output .= ' '; return $output; } ?>
 * 1) The callback function for converting the input text to HTML output

More info

 * See a live demo.
 * http://www.google.com/analytics/
 * It is possible to use Google Analytics in Mediawiki without tracking sysop users. However, you will need to modify the source code of your SkinTemplate.php file.  For more info:  http://www.pesme.net.