A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
The js/ folder contains:
js/index.php (or implicitly as “js/”) can be used to serve up the minified piwik.js
js/index.php (or implicitly as “js/”) can also act as a proxy to matomo.php
If you are concerned about the impact of browser-based privacy filters which attempt to block tracking, you can change your tracking code to use “js/” instead of “piwik.js” and “matomo.php”, respectively.
Note that in order for Page Overlay to work,
the Piwik tracker method
setAPIUrl() needs to be called
with its parameter pointing to the root directory of Piwik. E.g.:
piwik.js is minified using YUICompressor 2.4.8. To install YUICompressor run:
$ cd /path/to/piwik/js/ $ wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.zip $ unzip yuicompressor-2.4.8.zip
To compress the code containing the evil “eval”, run:
$ cd /path/to/piwik/js/ $ sed '/<DEBUG>/,/<\/DEBUG>/d' < piwik.js | sed 's/eval/replacedEvilString/' | java -jar yuicompressor-2.4.8.jar --type js --line-break 1000 | sed 's/replacedEvilString/eval/' | sed 's/^[/][*]/\/*!/' > piwik.min.js && cp piwik.min.js ../piwik.js && cp piwik.min.js ../matomo.js
This will generate the minify /path/to/piwik/js/piwik.min.js and copy it to /path/to/piwik/piwik.js. Both “js/piwik.min.js” and “piwik.js” need to be committed.
We recommend to execute this command under Linux. It has not been tested with Windows and MacOS might add a trailing newline which fails tests. VisitorGeolocatorTest
Information about the current version number you have installed can be found under What version of Piwik do I have?.