0plus1
0plus1

Reputation: 4555

Is it possible to determine if a user finished to see an embedded youtube video with the api?

I need to check if a user has actually seen an embedded youtube video (meaning that he pressed play and saw until the end). Is it possible to do this with the youtube api (javascript)?

Thank you very much

Regards

Upvotes: 2

Views: 3908

Answers (2)

Allan Jikamu
Allan Jikamu

Reputation: 341

Using the Youtube API is the most easiest way determining if the user clicked the play button.

  • For starters check out the Google Youtube Api: https://developers.google.com/youtube/js_api_reference

  • You will be needing to use the Swfobject.js to load the video to use the Youtube API controls

  • on loading the video don't forget to add a listener (addListener)
  • when the API or the video was loaded you will able to see the state of the videos , here are those:
    • "-1" - video is ready to play
    • "1" - the video is playing (it clicked the play button)
    • "2" - the video is paused
    • "0" - end of the video

Sample coding on checking the current state of the loaded video: https://developers.google.com/youtube/js_api_reference#SubscribingEvents

Upvotes: 1

nycmixing
nycmixing

Reputation: 127

If it is a chromeless YouTube player or if you embedded the video via JW Player, then it is possible.

The chromeless player will strip out the coding and allow you to embed the YouTube video like javascript, once done, then you can embed a Google Analytics extension snippet/code to the address of the video and track the hits that way. Another way is installing JW Player which allows you to easily track analytics for YouTube videos by incorporating your Google Analytics UPI.

Upvotes: 0

Related Questions