CRA Insights

Clean Power Planning: How utilities, IPPs, and states should be planning for a world with carbon

March 7, 2017

(and YouTube player) after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player(‘youTubePlayer’, {
videoId: ‘islRTtIvf2A’, //the code at the end of your old iframe embed script
height: ‘321’,
width: ‘570’,
events: {
‘onReady’: onPlayerReady,
‘onStateChange’: onPlayerStateChange
}
});
}

function onPlayerReady(event) {
//event.target.playVideo();
}

function onPlayerStateChange(event) {
// track when user clicks to Play
if (event.data == YT.PlayerState.PLAYING) {
ga(‘send’, ‘event’, ‘Videos’, ‘Play’, ‘Energy – CPP’);
}

// track when user clicks to Pause
if (event.data == YT.PlayerState.PAUSED) {
ga(‘send’, ‘event’, ‘Videos’, ‘Pause’, ‘Energy – CPP’);
}

// track when video ends
if (event.data == YT.PlayerState.ENDED) {
ga(‘send’, ‘event’, ‘Videos’, ‘Finished’, ‘Energy – CPP’);
}
}

//–>

*/