Wiki/Google analytics

From Skypher

Jump to: navigation, search

This page explains how to add Google Analytics to all pages on your wiki. It does not require changing any of the source files in your wiki, you can do this by simply modifying a few MediaWiki: pages.


To add Google Analytics to your wiki using JavaScript, you need to do these things:

  1. Create MediaWiki:GoogleAnalytics.js on your wiki and copy the contents from the page on this wiki.
Do not forget to change the userid (UA-XXXXXX-X) to your userid.
  1. Change MediaWiki:Common.js and add this line: {{MediaWiki:GoogleAnalytics.js}}

That is all but you may need to refresh your browsers cache to activate it on your machine. You can make sure it is installed by looking at the contents of this URL:

http://[your site]/wiki/index.php?title=-&action=raw&smaxage=0&gen=js

It should contain the code you created on the MediaWiki:GoogleAnalytics.js page along with other scripts used by MediaWiki. This URL is loaded as JavaScript on every page in your wiki, so you should be able to track all visits.

Personal tools