Tracking Events is a very useful way to measure interactions your users make with your website content, which are not directly page views or downloads. Typically events are used to track clicks on elements in your pages such as menu, widgets, Flash elements, AJAX actions, or even actions within games or media content.
Anatomy of Events
An Event has four components. These values are displayed in your reports:
- Name (optional, recommended)
- Value (optional)
Viewing Events Reports
Go to Matomo (Piwik). In the menu click Actions and then Events.
trackEvent(category, action, [name], [value])
It will log an event with an event category (Videos, Music, Games…), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked…), and an optional event name and optional numeric value.
_paq.push(['trackEvent', 'Documentary', 'Play', 'Thrive']);
To track the progress of playing a particular movie, for example when 20% of the movie has been played already:
_paq.push(['trackEvent', 'Documentary', 'Play-20%', 'Thrive']);
You may also track numeric values for your event. Event value is often used to track ratings and scores of particular items, such as tracking a rating of 9.5 out of 10 for Thrive:
_paq.push(['trackEvent', 'Documentary', 'Rating', 'Thrive', 9.5]);
Matomo reports for events will include the Total Event value, the Average event value as well as the Minimum and Maximum value, for each Event Category and each Event Name and each Event Action.
Tracking Events with HTTP API
Use Event Tracking from any application or server, with the Tracking API. View the Event Tracking HTTP API here.
Requesting Events report data
You may use the Events API to request all data for Events, including any report combining Event Categories, Event names and Event actions (see
Events are used to track interactions which are not pageviews. You can track all kinds of interactions with Events, but in some cases we have created specific and better ways to measure specific interactions:
- Tracking downloads.
- Tracking outlinks (clicks on external websites).
- Tracking Video players and Audio players.
- Tracking Ads, HTML blocks using Content Tracking.