MktoMunchkin :: YouTube Player API

HTML

<script type="text/javascript">
document.write(unescape("%3Cscript src='//munchkin.marketo.net/munchkin-beta.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<div id="player"></div>
<script>
   // 1. Start Munchkin
   Munchkin.init('410-XOR-673');

   // 2. This code loads the IFrame Player API code asynchronously.
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/iframe_api";
  document.getElementsByTagName('head')[0].appendChild(tag);

  // 3. This function creates an <iframe> (and YouTube Player) after the API code downloads.
  var player, loggedInterestingMoment, videoId = 'M7lc1UVf-VE', interestingMomentSS = 10;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      height: '390',
      width: '640',
      videoId: videoId,
      events: {
        'onStateChange': onPlayerStateChange
      }
    });
  }

  // 4. The API calls this function when the player's state changes.
  function onPlayerStateChange(event) {

    if ( player.getCurrentTime() >= interestingMomentSS && !loggedInterestingMoment ) {
        Munchkin.munchkinFunction('clickLink', {
            href: '/munchkinVideoTracker/?video=' + videoId + '&movie-action=passed-im-mark'
        });
        loggedInterestingMoment = true;
    }
    
    switch( event.data ) {
    case YT.PlayerState.PLAYING:
        Munchkin.munchkinFunction('clickLink', {
            href: '/munchkinVideoTracker/?video=' + videoId + '&movie-action=pressed-play'
        });
        break;
    case YT.PlayerState.PAUSED:
        Munchkin.munchkinFunction('clickLink', {
            href: '/munchkinVideoTracker/?video=' + videoId + '&movie-action=paused'
        });
        break;
    case YT.PlayerState.ENDED:
        Munchkin.munchkinFunction('clickLink', {
            href: '/munchkinVideoTracker/?video=' + videoId + '&movie-action=played-til-end'
        });
        break;
     }

  }
</script>

<iframe src="https://player.vimeo.com/video/76979871"...