Statcounter

From The System Administrator Zone


Mediawiki Integration

The StatCounter extension inserts StatCounter.com script into MediaWiki pages for tracking. The hit counter is displayed on the sidebar, in a new portlet.


StatCounterHooks.class.php

The project-id and security codes are entered and updated in StatCounterHooks.class.php.

	public static function onSkinBuildSidebar( $skin, &$bar ) {
		$projectId = (int)$skin->msg( 'PROJECT-ID' )->plain();
		$security = htmlspecialchars( $skin->msg( 'SECURITY' )->plain(), ENT_QUOTES );
		// Quickie test to check whether this thing's been set up correctly or not
		if ( $skin->msg( 'statcounter-project-id' )->isDisabled() ) {
			return true;
		}


Entering Project-ID and Security Code

In addition to adding them to the source, the Project-ID have to be added to manually created pages.

Open the two following pages on your mediawiki site:

 [[MediaWiki:Statcounter-project-id]] 
 [[MediaWiki:Statcounter-security]]

Create a new page if needed and place the raw codes without any formatting or newlines on those pages.