Piwik Analytics

piwik.png

Piwik is a downloadable, Free/Libre (GPLv3 licensed) real time web analytics software program. It provides you with detailed reports on your website visitors: the search engines and keywords they used, the language they speak, your popular pages...

http://piwik.org/

Piwik is a great alternative to Google Analytics, especially if you want to host the analytics engine on your own web server.

Here's how to integrate the Piwik tracking code within your Onpub frontend interface:

  1. Create a file called onpub_foot.php within your onpub/local/ directory.
  2. Paste the Piwik tracking code in to the onpub/local/onpub_foot.php file and save.

The contents of your onpub_foot.php file should now look similar to the following code:

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://[your_domain_name]/piwik/" : "http://[your_domain_name]/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", [site_id]);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://[your_domain_name]/piwik/piwik.php?idsite=[site_id]" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

Make sure you replace the [your_domain_name] parts in the code above with the actual domain name of your Piwik installation. Also be sure to replace [site_id], with the actual ID of the site you are tracking. Save the file and next time you reload the frontend in your browser, this code will automatically be included on every page of your Onpub-powered website.