Join 3,512 readers in helping fund MetaFilter (Hide)


Not until you finish watching your YouTubes, mister.
September 20, 2011 10:32 AM   Subscribe

Is there some way (maybe with javascript?) to track how much of an embedded YouTube video someone has watched on my website?

I want to embed a longish YouTube video and keep track of whether or not my users have watched (or rather played) it from beginning to end. Ideally, the system would be able to tell the difference between them having actually watched it and them having simply advanced the head to moments before the end.

I would also like, if they have only watched part of it, to save their timestamp so that I can queue it up to that point next time they return to the page. It would be ideal if this timestamp saving could be done automatically when they navigate away, but if it can only be done with a "save timestamp" button, that's okay.

I know that the YouTube player tracks these things, but is there any way for me to get access to the information?

Unfortunately, it has to be YouTube.
posted by 256 to Computers & Internet (1 answer total)
 
The YouTube Javascript API has some hooks for doing this

You'll need to add an event listener to capature the start/stop events.
http://code.google.com/apis/youtube/js_api_reference.html#Adding_event_listener

Then query the current playback status for duration
http://code.google.com/apis/youtube/js_api_reference.html#Playback_status
posted by bitdamaged at 10:43 AM on September 20, 2011 [3 favorites]


« Older Fantasy ID filter: book read i...   |  Funeral road trip this weekend... Newer »
This thread is closed to new comments.