Recording Embedded YouTube Video Interactions
LunaMetrics published a script that records YouTube cues, buffers, plays, pauses, and watches to end. Lots of user feedback has resulted in multiple versions that took into account common possible problems. There are a few caveats to keep in mind when implementing the script:
- You must use the iframe embed method. The site I was working on used a shortcode to embed YouTube videos with the old object embed method, and I had to update the script.
- The script requires jQuery (although I was working on a WordPress site so it usually required anyway).
- Any number of videos can appear on the page, but you cannot repeat a video to get correct results.
- The script does not record the time watched.
- Finally, do not select Enable privacy-enhanced mode when grabbing the embed code.
Tracking Outbound Links, Downloads, and Contact Links
To complement the video views script, I located a script from Blast Analytics and Marketing that could track all link clicks. The script categorizes the clicks automatically as downloads, outbound links, email and phone in GA. It also requires jQuery, but what luck, so does the other script.
With GA’s new live event tracking I was able to test both scripts right away!
NOTE: I am running both the new universal analytics.js tag and the current asynchronous ga.js (actually dc.js for GA remarketing list building) tag on the site. Events are getting recorded only in the profile that uses the async tag. Hopefully the authors will consider getting new versions out.