Hi John
If you are adding a lot of YouTube video to your site then at some point you will want to analyse performance, started, playerd in full etc
This can only be achieved by adding a dedicated HTML module to the page and adding script to the header or footer in setting of the module
<div id="player"></div>
<script>
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
var lastAction = '';
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
playerVars: {
modestbranding: true,
theme: 'light',
rel: 0
},
height: '315',
width: '560',
videoId: 'Qmi8XptOPbY',
events: {
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerStateChange(event) {
switch (event.data) {
case YT.PlayerState.PLAYING:
//_gaq.push(['_trackEvent', 'vid_maurice2', 'started', player.getVideoUrl()]);
_gaq.push(['_trackEvent', 'vid_maurice2', 'started', 'overview']);
break;
case YT.PlayerState.ENDED:
_gaq.push(['_trackEvent', 'vid_maurice2', 'completed', 'overview']);
break;
case YT.PlayerState.PAUSED:
if (lastAction != 'paused') {
_gaq.push(['_trackEvent', 'vid_maurice', 'paused', 'overview']);
} else {
lastAction = 'paused';
}
break;
}
}
</script>
This means you get feedback in Google analytics
See this video here http://www.inspirecc.com/individual-services/gaining-confidence.aspx
And all over that site
Hope this helps
Dave