Piwik Analytics

Difficulty: Advanced | Updated: June 23, 2015

Pro Feature
You can track Impressions and Clicks using Piwik Analytics.
This gives you a bit more flexibility with what kind of adverts you’re tracking. Including HTML5 and even Flash ads.


Using the Piwik option all statistics are tracked externally, using a few special tags AdRotate adds to your adverts and the Piwik tracking code.

AdRotate can detect simple banner images, flash ads and even some HTML5/iFrame adverts and add the Piwik tags in the code by itself.


Tracking code

If you use Piwik Analytics you should already have their tracking code in your site.
To track stats with it you need to alter it a tiny bit to have it recognise content blocks.
Add the line _paq.push(['trackAllContentImpressions']); to your tracking code and you should be good.

The tracker then should look something like this:
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
(function() {
var u="https://your.pikwik/setup/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
<noscript><p><img src="https://your.pikwik/setup/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

Once set up, your next Piwik report should include stats from your adverts.

Seeing your statistics

When you track stats remotely they are no longer visible in your AdRotate Dashboard.

If you log in to your Piwik dashboard and navigate to Contents in the Actions menu you should see something like this:
As you can see, nobody clicks the adverts on my blog.