Search code examples
javascriptgoogle-analyticsuniversal-analytics

Google Analytics Hover Event Tracking


This is how I'm tracking on click events with GA Universal Analytics. How do I do this with hover?

ga('send', 'event', 'button', 'click', {'nonInteraction': 1, 'eventLabel': 'bottom-cta', 'page': document.URL, 'eventValue': 0});

is it just this?

ga('send', 'event', 'button', 'hover', {'nonInteraction': 1, 'eventLabel': 'bottom-cta', 'page': document.URL, 'eventValue': 0});

Solution

  • To track event hover, you still need to add the proper JavaScript. For example if you were using jQuery:

    $("#someID").mouseover(function(){
        ga('send', 'event', 'button', 'hover', ...);
    )}
    

    The main point being that the GA event parameters don't define the logic of the event. It's still JavaScript in the end that does that.