My Web Analytics & Online Marketing blog      |  My Yahoo! Analytics Book     

Home / Blog

Tracking Streaming Windows Media - a quick Web Analytics HACK

- by Dennis R. Mortensen. Sunday, November 25, 2007 email  print   share

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:

  1. Stopped - Playback of the current media item is stopped.
  2. Paused - Playback of the current media item is paused. When a media item is paused, resuming playback begins from the same location.
  3. Playing - The current media item is playing.
  4. ScanForward - The current media item is fast forwarding.
  5. ScanReverse - The current media item is fast rewinding.
  6. Buffering - The current media item is getting additional data from the server.
  7. Waiting - Connection is established, but the server is not sending data. Waiting for session to begin.
  8. MediaEnded - Media item has completed playback.
  9. Transitioning - Preparing new media item.
  10. Ready - Ready to begin playing.
  11. 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 :-)


6 Comments:

  1. Bryan Eisenberg Says:

    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.

  2. Dennis R. Mortensen Says:

    Hi Bryan,

    Sounds like a deal! :-)

    Cheers
    Dennis

  3. carl Says:

    Hi Dennis,
    Looks good, but the movie file only seems to work in Internet Explorer, which I guess is a problem…

  4. Dennis R. Mortensen Says:

    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.

  5. Anonymous Says:

    Awesome Dennis,
    thanks for sharing this hack

  6. Dennis R. Mortensen Says:

    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

Comment: