Ubuntu Mediawiki Tracking Visitors: Difference between revisions

From CompleteNoobs
Jump to navigation Jump to search
AwesomO (talk | contribs)
Created page with " Options to See If Anyone is visiting your Wiki ==HitCounters== As easy as installing an extension: https://www.mediawiki.org/wiki/Extension:HitCounters * Move to your wiki's extensions directory <code>cd /var/www/html/mediawiki/extensions</code> * Download the extension from GIT <code>git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HitCounters</code> * Enable it in LocalSettings.php by adding the line: <pre> wfLoadExtension( 'HitCounters' ); </pre> * Ru..."
 
(No difference)

Latest revision as of 14:57, 24 June 2025

Options to See If Anyone is visiting your Wiki

HitCounters

As easy as installing an extension: https://www.mediawiki.org/wiki/Extension:HitCounters

  • Move to your wiki's extensions directory

cd /var/www/html/mediawiki/extensions

  • Download the extension from GIT

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HitCounters

  • Enable it in LocalSettings.php by adding the line:
wfLoadExtension( 'HitCounters' );
  • Run the MediaWiki update script to create necessary database tables:

php /var/www/html/mediawiki/maintenance/update.php

  • Check Special:PopularPages

https://www.completenoobs.com/noobs/Special:PopularPages

  • Can add the line in a wiki page to link to PopluarPages
{{Special:PopularPages/10}}

Error Warning

for some reason i had a clash with ContributionScores , i did not take notes on the error, it was trying to use a database entrie that was not avable (this only happened after installing HitCounters), Error only on Main_Page

  • Solved:

Commented out all ContributionScores lines in LocalSettings.php, re-ran wiki update php /var/www/html/mediawiki/maintenance/update.php, worked, uncommented all ContributionScores and updated wiki again, and so some reason it worked! now both are running on wiki.

Google Analytics

  • Requires an Google Account

Extension Install

  • Go to your wiki's extensions directory

cd /var/www/html/mediawiki/extensions

  • Download the extension from GIT

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/googleAnalytics

  • This part is done for now, go to Google Analytics Page to create a DataStream For your wiki.


Google Account

  • ADD STREAM > WEB > Enter WEBSITE URL and give the STREAM a name > Click 'CREATE AND CONTINUE' > Click 'Install manually', there you will see your Unique Measurement ID in the javascript
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-T9920YJMQ3"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-T9920YJMQ3');
</script>
  • My Unique Measurement ID is: G-T9920YJMQ3

LocalSettings.php

  • In this Example my Measurement ID is G-T9920YJMQ3
# GoogleAnalyticsAccount
require_once "$IP/extensions/googleAnalytics/googleAnalytics.php";

$wgGoogleAnalyticsOtherCode = '<script async src="https://www.googletagmanager.com/gtag/js?id=G-T9920YJMQ3"></script>';
  • Should now all be working, If you now test in Google it should good.

Analyze Apache Access Logs with Log Analysis Software

you already have your apache logs: /var/log/apache2/access.log which you can already read with no app, been having problems with all app's i have been trying, will try again later.