How can I track custom events in Matomo?

Hello everyone,

I’m using Matomo for web analytics on my website, and I would like to track some custom events that are important for my business. I have already set up the basic tracking code and it’s working fine for tracking page views and other default metrics.

However, I’m not sure how to track specific events that occur on my website, such as button clicks, form submissions, or video plays. I want to be able to measure the performance and engagement of these events in Matomo.

Could someone please guide me on how to track custom events in Matomo? Do I need to modify the tracking code or use any additional plugins? Any help or example code snippets would be greatly appreciated.

Thank you in advance!


There is several ways to track events.
The best one is using the Matomo Tag Manager tracking code (it will allow you to write code with a clear user interface)

The second one is to trigger events using code right in your source code (not the best way, but work properly)

The third one is using the HTTP API with all “events” parameters (you can use this tool to build the request →