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 .= '_uacct = "'.$argv["uacct"].'";'; $output .= ' '; $output .= ''; $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 also possible to insert Google Analytics in Mediawiki, not including admin trace, but you need to modify the code, click http://www.pesme.net to get more information.