PHP script for Mousotron data collection

Official text from developer website

What is Mousotron

Mousotron is a mouse and keyboard activity monitor and keeps statistics of your mileage. It's like an odometer or tripometer for your mouse cursor.

It calculates just how far your mouse cursor has traveled on your screen and how many times the mouse buttons were clicked. Also the number of keystrokes on your keyboard are counted.

More info on official website
Mousotron on own website [official website]

About PHP script

This script help you safe data sended (imported/uploaded) from Mousotron to CSV file on your own server/website.
(With small modification you cold save data to Database for e.g. MySQL)
This data you can import/open in any Spreadsheet aplication (with support CSV) like LibreOffice or OpenOffice.
Also you can open this file in any onother text based editor.
This script is tested and developed on Mousotron versio 11.00

PHP script will set file permission for writting to CSV file when is used/executed.

Saved data and data info

In template is prepared first line with names for columns (this line must be separated - add new line after it).
Data will be added to new line.

Mousotron sended data

Sample data send from mousotron


This data are saved in to CVS file "data.csv".

Items description:

dist : distance
lb : left button clicks
rb : right button clicks
dc : double clicks
ks : keystrokes / count of hits on keyboard
mb : middle button clicks
scr : mousewheel scrolls
reset : reset date / count start
m2 : currently not used
m3 : currently not used
al : alias / data source name
mac : (...not sure maybe unique identifier)
cmt : comment
ver : mousotron version
datetime : curent date and time when was data imported/uploaded (not part of mousotron)

CSV data file

CSV file format setup:

  • charset utf-8
  • string in douhle quotes (")
  • data separator semicolon (;)



  • add new line after column name line
  • rename titles at will but the order must remain

PHP Script

if( !empty($_POST) ){


  $qi = array(
      'dist' => @$_POST['dist'],
      'lb' => @$_POST['lb'],
      'rb' => @$_POST['rb'],
      'dc' => @$_POST['dc'],
      'ks' => @$_POST['ks'],
      'mb' => @$_POST['mb'],
      'scr' => @$_POST['scr'],
      'reset' => @$_POST['reset'],
      'm2' => @$_POST['m2'],
      'm3' => @$_POST['m3'],
      'al' => @$_POST['al'],
      'mac' => @$_POST['mac'],
      'cmt' => @$_POST['cmt'],
      'ver' => @$_POST['ver'],
      'datetime' => date('Y-m-d H:i:s')

  //CSV or TXT data imput
  //add data to CSV file to end of file
  $fp = fopen('data.csv', 'a');
  fputcsv($fp, $qi, ';', '"');//PHP5 >
  //fwrite($fp, implode(';', $qi) . "\n");//PHP 4


  // OR insert data to database...

  echo 'No data input!';


.zip file for download

  • php script
  • CSV file for data
  • Mousotron not included!!!
Download (.zip file)

Release notes

Vesrion 0.1

initial simple release