I have a video playing within a div on a site. The video requires a click to play. I’m wondering if it would be possible to apply some analytic event tracking tO the parent div that tracks anytime there is a click within the div.
I know you can use an onClick event with analytics, but am not quite sure if it could be applied to a div rather than, say, an outbound link like this:
<a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'vid 1']);">Click Here</a>
Has anybody body ever done something like this? I realize there are some downfalls to this (user repeatedly clicking play/pause) etc.
Thanks.
*Edit – I should probably have mentioned that I am unclear of how I would turn the div into a clickable event.
Say my div is . What would I need to do to make the whole div into an onClick event?
You can certainly do something like this:
However: when you place flash inside, there could be issues with click propagation, depending on your browser. It is better to give this library a try:
Google Analytics Tracking for Adobe Flash Library.