DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:statistics

This is an old revision of the document!


Statistics Plugin

Compatible with DokuWiki

Hrun, Ponder Stibbons, Binky, Weatherwax

plugin Log and analyze access statistics

Last updated on
2016-08-17
Provides
Admin, Action
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to logstats, quickstats, statdisplay

Tagged with logging, mysql, statistics

This plugin provides logging and statistics on views and visitors of your wiki. The statistics are a mix of wiki centric stats (like number of edits) and typical web statistics (views, visitors). It should be most useful to people using DokuWiki as their blog or homepage but provides useful stats for internal use as well.

:!: This plugin needs a MySQL database. You need at least MySQL 4.1, MySQL 5.0 or higher is recommended.

The following statistics are currently provided:

  • Dashboard
    • general statistics like Bounces, Returning Vistors, Average Session lengths
  • Popular Pages
    • the most viewed pages
  • Incoming Links
    • the top referrers
  • New Incoming Links
    • the top referrers which were not seen before the selected time frame
  • Outgoing Links
    • the most clicked outgoing links
  • Search Engines
    • the most used search engines to find your wiki
  • External Search Phrases
    • the top search phrases people used in search engines to find your wiki
  • External Search Words
    • the top search keywords people used in search engines to find your wiki
  • Internal Search Phrases
    • the top search phrases people used in your integrated wiki search
  • Internal Search Words
    • the top search keywords people used in your integrated wiki search
  • Browsers
    • the most used browsers to view your wiki
  • Operating Systems
    • the most used operating systems used by your visitors
  • Countries
    • where your visitors came from in the selected time frame
  • Screensize
    • the screen size your visitors have
  • Resolution
    • the screen resolution used by your visitors

For nearly all these stats, graphical diagrams are provided as well.

Download

Please use the download link provided above for downloading the plugin. Be sure to read about upgrading first, if you are running an older version already.

Changes

Installing

  1. Install the plugin through the Plugin Manager or manually.
    1. Install php5 mysqli 1)
  2. Create the MySQL database. Without this you wont be able to do the next step.
  3. Create the needed MySQL tables with the provided db.sql file
  4. Configure the database access through the Config Manager

To create the needed MySQL tables you can

  1. either use phpmyadmin's import function
    • Select the database that is used by your DokuWiki and chose “Import” from the top-menu, then upload the file.
  2. import manually using MySQL in your shell

Method 1

# mysql -u db_user -p your_dokuwiki_database < /full/path/to/db.sql

Method 2

# mysql -u db_user -p your_dokuwiki_database
Enter password:
[...]
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> \. /full/path/to/db.sql

Upgrading

Upgrades will most probably require database upgrades. I recommend to do them before updating the plugin.

  1. Have a look at the current db.sql.
  2. Search this file for lines starting with -- UPGRADE
  3. Find the first such line containing a date newer than your plugin version
  4. Copy all following lines and apply them to your existing database

Please note that, depending on the amount of data in your database, these updates can take a really long time. I suggest to run these updates via the command line instead of using a web based tool like PHPMyAdmin.

Known limitations

  • Currently only users with JavaScript enabled are logged
    • this can be easily fixed by placing some <noscript> code in the template, I just need to investigate that
    • when fixed, stats about search bots could be added
  • the search word parsing is a bit flaky (“don't” is two words)

Known Issues

Wiki becomes inaccessible

Symptoms: Wiki becomes completely inaccessible after install and Databse setup

Cause: There is a missing MySQL Component not included in the standard installation of MySQL for the Linux distribution.

With MySQL components missing the whole wiki is rendered inaccessible due to MySQL transactions failing prior to logins or any user actions being logged or at least being attempted to log. Reviewing the apache logs revealed my particular issue and exposed the missing components.

# find all the recent logs being generated on the server in the last 5 minutes only
 
  find / -name '*.log' -mmin -5
 
# the results on my Ubuntu server:
 
/var/log/auth.log
/var/log/apache2/error.log
/var/log/apache2/access.log
 
# reviewing the apache error log showed:
# command:
 
  tail /var/log/apache2/error.log
 
# result:
 
[Tue Aug 30 07:17:08.713698 2016] [:error] [pid 1466] [client xxx.xx.xxx.xx:62175] PHP Fatal error:  Call to undefined function mysqli_connect() in /var/www/wiki/lib/plugins/statistics/helper.php on line 73, referer: http://www.myserver.net/doku.php/linux:shell_scripts?do=login&sectok=ab148cc7681f1269efe3997b20cd5aa2

The fix was to install the missing component either php-mysqli2) or php5-mysql3), depending on the Linux distribution you use.

Report Images not rendering

Error: from the apache log again: PHP Fatal error: Call to undefined function imagecreatetruecolor()

Solution: apt-get install php5-gd4)

:!: Apache server needs to be restarted5) to load “gd”

1)
for Debian/Ubuntu apt-get install php5-mysql or CentOS etc sudo yum install php-mysqli
2)
RedHat/CentOS etc
3)
required for Debian/Ubuntu
4)
fix for Debian/Ubuntu, might need another library for other distros.
5)
service apache2 restart
plugin/statistics.1472551330.txt.gz · Last modified: 2016-08-30 12:02 by 194.73.108.104

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki