Track banner clicks on

Hi all,

We’re trying to log the clicks on the 4 banners on our website

Now we’ve added some trackevent JS to the banners:

for example:
a onclick="_paq.push([‘trackEvent’, ‘CategoryName’, ‘ActionName’, ‘ActionValue’]);"

We’de expect that the tracked events would appear on the PIWIK \ ACTIONS \ EVENTS view, but there’s nothing to show in the events section :-(.

Any help would be appreciated.

kind regards,


The small snippet of code you provided looks right.

Can you provide a bit more code?
What version of Piwik are you running?
Are there any JS errors (Try Firebug).

Hi Valdhor,

I’ve now tried to gather the tracking informatie with campaigns instead of tracking events

but still like to use Javascript instead.

Piwik 2.16.2

Couldn’t find any errors while using firebug

Even tracking should work. Do they appear in Visitors > Visitor log ?

1 Like

After reading a great e-book: we found the right solution for our wish:

Tracking with events was a rather difficult task and didn’t seem to work as expected

Solved it now by adding the "_paq.push([‘trackVisibleContentImpressions’]);"element to the tracking code and added classes to the banners.

example banner code:
<p><a class="piwikTrackContent" href="site-I-want-to-link-to.html"><img title="banner1" src="" alt="e-commerce-banner" data-content-name="werkt" /></a></p>

Result in PIWIK:

> <!-- Piwik -->
> <script type="text/javascript">
>   var _paq = _paq || [];
>   _paq.push(['trackPageView']);
>   _paq.push(['enableLinkTracking']);
> _paq.push(['trackVisibleContentImpressions']);
>   (function() {
>     var u="//";
>     _paq.push(['setTrackerUrl', u+'piwik.php']);
>     _paq.push(['setSiteId', '3']);
>     _paq.push(['trackVisibleContentImpressions']);
>     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);
>   })();
> </script>
> <noscript><p><img src="//" style="border:0;" alt="" /></p></noscript>
> <!-- End Piwik Code -->