Tracking Streaming Windows Media – a quick Web Analytics HACK
I was talking to Tim (in technical support) the other day, about streaming windows media tracking – and he pointed out a method to retrieve a number of events directly from the windows media object (which I simply had to try out myself) – and by that, a chance to collect a plethora of streaming online video metrics.
This is not a post about particular online video KPI’s (which is a separate post I will most certainly do), but a HACK on how to actually retrieve the information.
So… let’s get to it. Using the following HTML object:
<OBJECT id=’DennisMediaPlayer’ width=”280″ height=”280″ classid=’CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95′ standby=’Loading…’ type=’application/x-oleobject’ >
<param name=’fileName’ value=”http://visualrevenue.com/blog/video/superman-video.wmv”>
<param name=’animationatStart’ value=’true’>
<param name=’transparentatStart’ value=’false’>
<param name=’autoStart’ value=”false”>
<param name=’showControls’ value=”true”>
<param name=’loop’ value=”false”>
<param name=”ShowStatusBar” value=”true”>
</OBJECT>
We get the following result:
(..and please be so kind as to interact with the video, so that I get some more data to play with)
Using the windows media player playState property we are provided with the following properties:
- Stopped – Playback of the current media item is stopped.
- Paused – Playback of the current media item is paused. When a media item is paused, resuming playback begins from the same location.
- Playing – The current media item is playing.
- ScanForward – The current media item is fast forwarding.
- ScanReverse – The current media item is fast rewinding.
- Buffering – The current media item is getting additional data from the server.
- Waiting – Connection is established, but the server is not sending data. Waiting for session to begin.
- MediaEnded – Media item has completed playback.
- Transitioning – Preparing new media item.
- Ready – Ready to begin playing.
- Reconnecting – Reconnecting to stream.
Which are all exciting metrics to collect, and without going into detail on why we should NOT setup 11 different actions (such as analytics compatibility between video channels), I created the following actions – and by that introduced 4 new metrics. (as indicated above I will post a separately about online video KPI’s)
- Online video started
- Online video positive consumption action
- Online video negative consumption action
- Online video ended
With the video object active on the site (as you see it in this post) AND the actions set up in my web analytics tool (as shown above). The next step is to create a function, that you can use to capture actions without a page-refresh. (the code below is how to do it in IndexTools, but most tools will provide you with a way to do this)
function onclickactiontracking (actionnumber)
{
var tracking_object = createITT();
tracking_object.ACTION = actionnumber;
tracking_object.submit_action();
}
With the above code in place, we now have everything needed to do the actual online video tracking. Tapping in to the DennisMediaPlayer object we can chose which events to collect. As an example, I have set the following up for the video in this post:
<script language=”Javascript” type=”text/javascript” for=”DennisMediaPlayer” event=”PlayStateChange(NewState)”>
switch (NewState)
{
case 1: // Stopped (negative)
onclickactiontracking(14);
break;
case 2: // Paused (positive)
onclickactiontracking(13);
break;
case 3: // Playing
onclickactiontracking(11);
break;
case 4: // ScanForward (negative)
onclickactiontracking(14);
break;
case 5: // ScanReverse (postitive)
onclickactiontracking(13);
break;
case 8: // Media Ended
onclickactiontracking(12);
break;
}
</script>
Conclusion:
That is it! You are now collecting online video event metrics and as said, this post does not hold any information on WHAT to collect (KPI’s) or HOW to analyse the collected data. More about that later.. Cheers – AND do ping me if anybody is going to SES in Chicago beginning December. We should meet up! :-)
N.B.
A test on the collected data shows that I am not catching the Media Ended event. note to myself; must look into that later :-)


November 25th, 2007 at 16:09
Dennis I will be at SES on the 2nd in the afternoon and will be around most of the 3rd. Why don’t we meet up on the 2nd at the Hilton.
November 27th, 2007 at 3:27
Hi Bryan,
Sounds like a deal! :-)
Cheers
Dennis
November 29th, 2007 at 5:50
Hi Dennis,
Looks good, but the movie file only seems to work in Internet Explorer, which I guess is a problem…
November 30th, 2007 at 6:08
Hi Carl,
Whether one wants to use “Windows Media Player” as your streaming video serving technology, is a good question, as non internet explorer users might be excluded, if they do not have the right “plug-in”. However; the post is more about – if – you have taken the choice of using that platform – then you can actually get some decent metrics – right out of the box.
But you make a very good – going to market with that platform – comment.
And yes!
… I actually did not check it in Firefox. I am one of Bill’s boys. :-)
Cheers
.. and thank you for the note Carl.
December 12th, 2007 at 1:47
Awesome Dennis,
thanks for sharing this hack
December 12th, 2007 at 7:04
Hi there…
>>Awesome Dennis,
>>thanks for sharing this hack
No worries. I was actually quite surprised to see the metric opportunities with media player – being that strong “out of the box”.
Cheers
August 8th, 2008 at 18:38
[...] their sisters) require completely different technical tracking methodologies and I actually posted a Web Analytics HACK on how to track server streamed online video not that long [...]
March 9th, 2010 at 16:21
[...] you host videos using your own flash player (or stream through Windows Media Player) then many different user activities can be recorded for analytics purposes, such as pressing the [...]