Quantcast
Channel: Savio.no - Blog
Viewing all articles
Browse latest Browse all 31

YouTube Chromeless Player with Google Analytics Event Tracking upgrade

$
0
0

This is just a short notice of an upgrade of my YouTube Chromeless Player with Google Analytics Event Tracking.

The player has been updated with a bug fix and a improvement to the Google Analytics Event Tracking.

Tracking time when somebody leaves the page or closes the browser window
Video - Stop Left Page is added to the player/Google Analytics Event Tracking. Earlier if a visitor just left the page or closed the browser windon, the time would be recorded as 0 seconds no matter how long the video had been playing. By using ununload and unbeforeunload the time is now tracked. The time will only be tracked if the video is either playing, buffering or is paused. This is done by checking getPlayerState.

If you are using a previous version and want to upgrade, look for the function leave() in the new youtube.js, and update the <body> tag in default.asp or index.php to this:
<body onload="embedPlayer();" onbeforeunload="leave();" onunload="leave();">

Google Analytics Asynchronous Tracking

The player is using the new Google Analytics Asynchronous Tracking. All the Google Analytics codes are placed inside youtube.js. You will have to change the Google Analytics UA-code (UA-XXXXX-X) to your account number.

Below you find a video about Tracking events using Advanced Segments in Google Analytics. I thought it was appropriate to integrate this video since it's a little bit about video segmentation in Google Analytics.

If you make any improvements to the player I would love to hear about it.

If you are familiar with my previous version of the player, Download my YouTube Chromeless Player Example (zip). If not I recommend you read my article YouTube Chromeless Player with Google Analytics Event Tracking first.


Viewing all articles
Browse latest Browse all 31

Trending Articles