Using Event-Tracking with Matomo
Can event tracking also be used with Matomo?
Event tracking can be used not only with Google Analytics, but also with Matomo. The triggered events are then stored as Matomo events and can be analysed in the Matomo reports afterwards.
General Instructions
You can find detailed documentation on implementing JavaScript events in Matomo in the official Matomo documentation on event tracking.
Example code for the integration
You can implement event tracking with Matomo using the following code in a <script> tag in the head section of your website. If Matomo is already integrated on your website, you do not need to insert the complete Matomo snippet again — see the note below for this. Make sure that this is integrated after the initialisation of _paq.
If you are setting up Matomo for the first time, you can use the following example code. Replace the placeholders YOUR_MATOMO_SERVER_URL and YOUR_SITE_ID with your own configuration.
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u = "//YOUR_MATOMO_SERVER_URL/";
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', 'YOUR_SITE_ID']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript'; g.async = true; g.src = u + 'matomo.js';
s.parentNode.insertBefore(g, s);
})();
// Register the Eye-Able events
document.addEventListener("eyeable:event", function (e) {
if(e.detail){
_paq.push(['trackEvent', 'Eye Able Event', 'Function', e.detail]);
}
});
Note: If Matomo is already integrated, you only need the following code:
document.addEventListener("eyeable:event", function (e) { if (e.detail) { _paq.push(['trackEvent', 'Eye Able Event', 'Function', e.detail]); } });
Data Security
If you use Matomo to track Eye-Able events, please take not of any applicable data protection regulations. In particular, find out whether and in what form the consent of users is required, and how the tracking can be set up in a way that complies with data protection requirements. Eye-Able is not responsible for any potential violations of data protection regulations.
Further information
You can find general information on tracking the use of the Eye-Able services in this article: Tracking the use of Eye-Able Services on your website
If you have any further questions, feel free to contact us at any time. You can find our contact options in the following article: Contact details for customers and interested parties