Track hover events

If you want to track hover events, we recommend that you add an event listener to track them for that element only by using something like the class name to identify it appropriately.

The sample code below can be implemented to capture hover events. It may differ slightly in your implementation depending on your specific use case. In this case, you should add a listener for when the user hovers over an element with the .myTooltipClass.

document.addEventListener('mouseover', function(e) {
  if (/myTooltipClass/.test(e.target.className)) {
    heap.track("Tooltip Hover");
  }
}, false);