To measure your websites with Piwik you are likely to use the Piwik JavaScript Tracking code, a small snippet of code that should be added in your websites pages. When visitors view your website, the Piwik tracking code gets executed by the browser and your visitor’s browsers load the piwik.js file from your Piwik server, for example: demo.piwik.org/piwik.js.

In some cases it may be useful to customise the piwik.js tracking code. This FAQ explains the best practise method to let you safely edit the piwik.js file. Note that this is an advanced feature and should be used with great care. First you will need to install and activate the plugin CustomTrackerJs. Login as a Super User in Piwik then go to Administration, click on Marketplace and install the plugin CustomTrackerJs. After activating this plugin, Super User can click on the Admin menu ‘Plugin Settings’ link. Any text entered in the field ‘Javascript code’ will be appended to the content of piwik.js.

For example, if you wanted to enable Content Tracking on all your websites at once, enter the following:

if ('undefined' !== typeof _paq) {
     _paq.push(['trackVisibleContentImpressions']);
}

Note: changing piwik.js will affect all your websites at once (all websites load the same piwik.js file). Use this feature with care: if you input invalid JavaScript code then it may create JavaScript errors on your websites.

Any questions?

Many answers and more information about Piwik You can find here:

We are social

Follow us: