Tracking mouse hovering over elements

Hi, how to set up tracking of mouse hovering over elements?
Thanks.

Hi @Tatyana
Just push a Matomo event on the mouseOver event.
You can add a listener thanks to a JavaScript tag run on page load…

Hoping to do this for mouse drag event. I am new to Matomo, can you provide reference on a ‘how to’ “push a Matomo event”?

You can track mouse hover by using a mouseover or mouseenter event in JavaScript and pushing it to the dataLayer for Google Tag Manager. Then create a trigger in GTM to capture that event and send it to your analytics tool. Just make sure the element has a clear ID or class to target.

If you’re using Matomo Tag Manager, this is actually pretty straightforward to set up without heavy coding. You can create a ‘Mouseover’ trigger and attach it to a Custom Event tag. Just make sure to use some ‘hover intent’ or a small timeout, otherwise, you might end up with a massive amount of data from people just moving their mouse across the screen!