javascript - Tracking clicks on videos in Google Analytics -


There is a client site where video content is populated by a video CDN by ADX. Each link is created like this:

  & lt; Class = "thumb-link" href = "/? Video = '. $ Video- & gt; Id.' 'Onclick = "show_video' $ Video- & gt; Id.', ''. $ Section '\'); Return back; "& Gt; & lt; img src =" '. $ Thumb. ' 'Width = "100" height = "65" alt = "" align = "left" /> gt; & Lt; / A & gt;  

But they report that analytics does not monitor ARP, since onclick to load content through javascript rather than go to a flash player and load the video Is saying.

What can I do to track this click (without going to the physical page) like they click on a page?

Can I add onclick and do something like this:

Add to anchor: onclick = "trackVideo ();"

Then, with javascript:

  function trackVideo () {path = $ (this) .attr ("href"); Var Page Tracker = _gat._getTracker ("UA-XXXXX-XX"); PageTracker._trackPageview (path); }  

I am not even familiar with the analytics, so if someone can get me in the right direction which will be great.

your example is correct, it will do what you want :)


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -