简体   繁体   中英

Piwik - How to track click events?

I configured Piwik analytics in my app.

I inserted this tracking code inside the body tag:

<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setDomains", ["*.mywebsite.com"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['trackAllContentImpressions']);
(function() {
  var u="//mywebsite.piwikpro.com/";
  _paq.push(['setTrackerUrl', u+'piwik.php']);
  _paq.push(['setSiteId', 3]);
  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="//eatngage.piwikpro.com/piwik.php?idsite=3"    
style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

And I added the event trigger to the div:

<div class="my-class" onclick="_paq.push(['trackEvent', 'Documentary',  
   'Play']);">Click
</div>

In Piwik Dashboard, I see the clicking under "Visitors in Real-Time", but not under "Actions-Events" category.

How can I tracking events click please?

Thanks!

You have to run archive process to see events under Actions-Events . Make also sure your setting that allows to trigger archiving from the browser is enabled.

As a reference, you can use this article about configuring archive proccess: http://piwik.org/docs/setup-auto-archiving/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM