1 | Introduction
|
---|
2 |
|
---|
3 | * The js/ folder contains:
|
---|
4 |
|
---|
5 | - index.php - a servlet described below
|
---|
6 | - piwik.js - the uncompressed piwik.js source for you to study or reference
|
---|
7 | - README - this documentation file
|
---|
8 |
|
---|
9 | Why Use "js/index.php"?
|
---|
10 |
|
---|
11 | * js/index.php (or implicitly as "js/") can be used to serve up the minified
|
---|
12 | piwik.js
|
---|
13 |
|
---|
14 | - it supports conditional-GET and Last-Modified, so piwik.js can be cached
|
---|
15 | by the browser
|
---|
16 | - it supports deflate/gzip compression if your web server (e.g., Apache
|
---|
17 | without mod_deflate or mod_gzip), shrinking the data transfer to 8K
|
---|
18 |
|
---|
19 | * js/index.php (or implicitly as "js/") can also act as a proxy to piwik.php
|
---|
20 |
|
---|
21 | * If you are concerned about the impact of browser-based privacy filters which
|
---|
22 | attempt to block tracking, you can change your tracking code to use "js/"
|
---|
23 | instead of "piwik.js" and "piwik.php", respectively.
|
---|
24 |
|
---|
25 | Deployment
|
---|
26 |
|
---|
27 | * piwik.js is minified using YUICompressor 2.4.2.
|
---|
28 | To install YUICompressor run:
|
---|
29 | $ cd /path/to/piwik/js/
|
---|
30 | $ wget http://www.julienlecomte.net/yuicompressor/yuicompressor-2.4.2.zip
|
---|
31 | $ unzip yuicompressor-2.4.2.zip
|
---|
32 |
|
---|
33 | To compress the code containing the evil "eval", either apply the patch from
|
---|
34 | http://yuilibrary.com/projects/yuicompressor/ticket/2343811,
|
---|
35 | or run:
|
---|
36 | $ cd /path/to/piwik/js/
|
---|
37 | $ sed '/<DEBUG>/,/<\/DEBUG>/d' < piwik.js | sed 's/eval/replacedEvilString/' | java -jar yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar --type js --line-break 1000 | sed 's/replacedEvilString/eval/' > piwik-min.js && cp piwik-min.js ../piwik.js
|
---|
38 |
|
---|
39 | This will generate the minify /path/to/piwik/js/piwik-min.js and copy it to
|
---|
40 | /path/to/piwik/piwik.js
|
---|
41 |
|
---|
42 | * In a production environment, the tests/javascript folder is not used and can
|
---|
43 | be removed (if present).
|
---|
44 |
|
---|
45 | Note: if the file "js/tests/enable_sqlite" exists, additional unit tests
|
---|
46 | (requires the sqlite extension) are enabled.
|
---|
47 |
|
---|