Piwik not tracking events - Piwik 3.2.0

Hello,

I am having a lot of problems with Piwik.

I have created a goo.gl link that sends the traffic to an affiliate. The links are attached to the event on piwik.

My code is as below:

Link:
<a href="https://goo.gl/xxxxxxxI" onclick="javascript:_paq.push(['trackEvent', 'group1', 'Link 1']);"><img src="images/image.jpg" id="fixedbutton" width="200px"></a>

My footer:

<script type="text/javascript">
    var _paq = _paq || [];
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
        var u="//mywebsite.com/analytics/";
        _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);
    })();
</script>

Is there something i am doing wrong please? None of the events are showing in Piwik when the link is clicked from mobiles. But when I click it on my desktop it works.

Thank you.

1 Like

Try adding “target=_blank” to the anchor and have a look at firebug if the event is fired correctly. If not, there seems to be an error somewhere.

2 Likes