The Google Analytics Integration extension inserts Google Universal Analytics (and/or other web analytics) tracking code in every page viewed. Exclusion of specific pages, namespaces, special pages and all pages for specific groups of users is configurable.
Download and place the file(s) in a directory called googleAnalytics in your extensions/ folder.
Add the following code at the bottom of your LocalSettings.php:
Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
The following options were removed in version 3.0.0:
The googleAnalytics.php file will override your variables that were set in the LocalSettings.php file if you include it after you set these variables. It will appear that settings are not working. Solution: Check the variables.
Google Analytics - this same extension but also allows you to ignore logged in users (new variable is used, $wgGoogleAnalyticsIgnoreUsers). This is useful since if we want true visitors statistics, we want to ignore logged-in users who are often 'wiki-workers' and perhaps we dont want to include their stats since they could have lots of page views, like sysops.(If you use the "following fix" from Bugs (above), edit line 25 from your googleAnalytics.php.) fork of version 2.0.1 of this extension.