Jump to content
Search Community

Has anyone used GA for Youtube video metrics

somnamblst test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I don't have access to the company's Google Analytics to verify, and AdOps doesn't know I am working on banners  that include Youtube video for DCM which would not know if a play button is clicked, unlike the DCRM video solutions. 

 

Found this when searching

 

http://www.htmlgoodies.com/beyond/video/trigger-specific-actions-on-youtube-video-player-events.html

 

 

 

Tracking YouTube player events is a great way to see what your visitors are actually watching. The following onStateChange handler will pass on information about the player's state to Google analytics via the global analytics object:

function onPlayerStateChange(event) {
  switch(event.data) {
    case YT.PlayerState.PLAYING:
      analytics.track('Played Video', {
        video: player.getVideoData().title,
        id: player.getVideoData().video_id,
        duration: player.getDuration()
      })
      break;
    case YT.PlayerState.PAUSED:
      analytics.track('Paused Video', {
        video: player.getVideoData().title,
        id: player.getVideoData().video_id,
        pausedAt: player.getCurrentTime()
      })
      break;
    case YT.PlayerState.ENDED:
      analytics.track('Finished Video', {
        video: player.getVideoData().title,
        id: player.getVideoData().video_id,
        duration: player.getDuration()
      })
      break;
    default:
      return;
  }
}
  • Like 1
Link to comment
Share on other sites

From what I remember in the Flash days of getting Google Analytics data from banner clicks, is that the page itself needs to match the GA ID, but I guess if in the case of a banner in an iFrame this might work?

 

 

If you had your own server with GA setup you could test this?

Link to comment
Share on other sites

I decided to take a different approach. But since I want the video in this particular campaign, to come in last, but not be user initiated, I have to have it hidden and paused, and then have Animate tell the video to play once that frame is reached.

 

I play around with this stuff, when I am waiting for approval on another campaign, which is frustrating, because now I have approval and can't get  back to Plan B video hidden and paused right away.

 

Or maybe the best approach would be to have Animate load a YTplayer iframe that is autoplay when the timeline hits a certain frame....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...