Click here to Skip to main content
Click here to Skip to main content

Web Session - Monitor, Record, and Video Playback

By , 6 Mar 2008
 

Introduction

Using JavaScript, a little AJAX, and an HTTP Module, we can record client DOM events by posting them to the server via small AJAX packets, storing the information in XML format for later retrieval. The XML could then be parsed either in real-time, or otherwise to provide a true visual representation of the user's session (in motion or with an accompanied timeline), enabling video playback of an entire visitor's session.

The concept has many applications:

  • Real-time web application technical support
  • This could be achieved by viewing a user's session to identify the issues whilst speaking to the visitor via messenger/telephone etc.

  • Web application training
  • Talk the user through the application whilst you view the session in action.

  • Advanced web statistics
  • Provide almost video playback of each and every visitor to a particular website.

  • Usability testing
  • Generate genuine usability figures by processing the session information captured.

  • Remote assistance
  • With a little tweaking, control could be passed to another session and events relayed to allow an administrator to take over a visitor's web page on request and perform clicks, fake mouse moves etc.

Limited only by your imagination I believe.

Concept Overview

The concept is to provide an HTTP Module that intercepts web requests and records session information in XML format. At the same time, it injects some client-side JavaScript that captures all the events on the page via the DOM. Using a very light-weight AJAX script, it sends information about each event such as tag name, event type, and event date (millisecond resolution) the event was triggered to the server. This information is then stored on the server in an XML structure under the current users session key for later retrieval.

The site administrator would then be able to view a list of all sessions on the server, select a session, and either choose to play back the entire session or view the almost real-time session in process. This could happen by loading a page containing an IFrame to show the pages visited, and the contained page executes a script to retrieve the events and fire them accordingly. To demonstrate the mouse movement, an absolute Div could be positioned over the page at the specified X and Y. Events on the page could be triggered using .fireevent or an equivalent method.

Alternatively, a Flash presentation type application could be created; together with some C# it could read the XML, have C# take a snapshot of the page as an image, load the image, and process events using mouse pointers etc., to demonstrate the events. As each event is recorded with a millisecond timing, the overall time of the session could be calculated and a timeline assigned, thus allowing the user to speed up the session playback or skip sections. Of course, as I have said, this could also be done in real time as the user is using the site.

The applications for this are immense. Why bother recording geo location and page visits when you could have it all together with a video of the entire session? A usability tool could be applied over the top to determine how difficult the user found the site. The point is, once you understand the concept, the possibilities are endless.

You could even transmit events from one session to another, creating remote assistance in the browser. Now, that's smart, right?

Required Elements

  • HTTP Module
  • Captures the session start and creates an application variable with the name of the session key. It then inserts an XML document into the variable as a string that would later be used for storing events. It injects a script file (link) into the page to load the monitoring events. The script file is requested from the HTTP Module and built on the fly, maybe using an embedded resource file as a template. This means we could have an XML config file on the server to allow the administrator to define which events he's interested in monitoring/recording for each visitor. Such as click, mouse move, mouse over, onbeforeunload, keyup, etc.

  • AJAX Layer
  • A light AJAX layer to allow sending of events without refresh. This must be light weight because I just hate all the overloaded frameworks out there, and it would only cripple the solution. The AJAX layer would take events into a local array/stack and push them to the server when possible, ensuring no events are missed. Common sense would need to be used here as we only want to send essential and compact information (so no complete form posts); find another way to do that. It should only be a few bytes at a time. Anything more could mean close to real-time viewing of sessions could be compromised due to the time taken to send/process events. Each event should be bytes in size including the HTTP header posted.

  • Admin Interface
  • Again, embed this into the HTTP Module as it will make the component more portable. Have a username and password stored in the web.config or another config file. Once the HTTP Module receives the request for the said page, it will prompt the user for login, and providing they pass, it will render the page containing a list of sessions sorted by time, with maybe a nice flag to show where each visitor is from. OK, you could go mad here and render them over Google Maps. Actually, that would be impressive - a Google globe map of your live sessions.

  • Playback
  • Again, an embedded resource to make the DLL portable. Provide a page that contains an IFrame tag, and again, light AJAX to retrieve the session XML in fragments. Using the IFrame, load the relevant pages when required. Using a Div with maybe an image of the mouse pointer, animate mouse movements. You could also tweak the IFrame DOM directly to fire the relevant events. (Maybe an elements GID could be created based on the original elements index in the DOM.)

  • Flash Movie
  • XML event information could be passed to a Flash interface. Maybe use C# to return an image of the required URL, and then use Flash to animate the pointer over the image to represent the session in motion. Again, this could be almost real-time.

    For full session viewing, the XML event file could be parsed and all event times processed to provide a second timeline of a session. This would mean the user could skip parts of the session similar to how they might skip sections of FLV videos. Alternatively, they could speed up the replay of the session.

  • Data Analysis
  • Given we have detailed event information in XML format, we could use this to estimate usability trends. E.g., how long it took the user to reach the final goal of the site (ordering a product, for example) before ending the session.

Event recording example (JavaScript)

var oAJAX = new AJAX();

window.onload=function()
{
    //
    // global mouse move
    //
    document.mousemove = function(e)
    {
        // send event to server with X and Y
        oAJAX.send("send Mouse X & Y, tagName " + 
                   "and Current Date/Time to the millisecond")
    }
    
    //
    // global mouse down
    //
    document.onmousedown = function(e)
    {
        // send event to server with X and Y
        oAJAX.send("send Mouse X & Y, tagName and " + 
                   "Current Date/Time to the millisecond")
    }

    //
    // get a collection of all tags
    //
    var aTags = document.getElementById("*");
    
    //
    // the events to be captured could be configured in an XML config
    // file on the server and this script file build on the fly.
    // therefore allowing the site administrator
    // to decide the events/elements to monitor.
    //
    for (var i=0; i<aTags.length; i++)
    {
        var el = aTags[i];
        
        el.onclick = function(e)
        {
            // send event to server
            AJAX.send("send Mouse X & Y, tagName and Current " + 
                      "Date/Time to the millisecond");
        }

        el.onmouseover = function(e)
        {
            // send event to server
            oAJAX.send("send Mouse X & Y, tagName and " + 
                       "Current Date/Time to the millisecond");
        }

        el.onblur = function(e)
        {
            // send event to server
            oAJAX.send("send Mouse X & Y, tagName and " + 
                       "Current Date/Time to the millisecond");
        }

    }   
}

Danger, Danger

There are, of course, many side effects to this concept. If we captured all events on the screen, this would also give us the ability to capture the message you were thinking of posting to a newsgroup but decided to delete, or maybe the chat room message you re-edited before posting. I guess when we get to this level of monitoring, it makes you realise how exposed we really are.

As JavaScript/AJAX are in massive use in today's browsers and applications, this technique could be created and implemented without the visitor ever realising they were being monitored.

Points of Interest

I do hope this makes sense; I would welcome any feedback. I am a behind the scenes type of developer, and therefore have never posted an article, so please don't shoot me down!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

John Doherty
Chief Technology Officer MammothWorkwear.com
United Kingdom United Kingdom
Member
Senior Web Developer/Systems Architect, One of the developers behind the 1999-2003 web based groupware application DeskVu/Convea. Presently CTO of MammothWorkwear.com, the UK's largest supplier of Dickies Workwear, Snickers Workwear and Caterpillar Workwear.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralThe idea is not new ;)))memberdavidg@actcom.co.il11 May '07 - 6:09 

There at least 3 startups provide such service and there are couple
pending patents Wink | ;) )) Crazy Egg, clicktale and TapeFailure ...
look at http://www.clicktale.com or http://crazyegg.com/
 
Rgds.;P

GeneralRe: The idea is not new ;))) PinmemberJohn-Howard12 May '07 - 6:14 
Hi David,
Very interesting, thanks for the links.
 
I have looked at the Click Tale product and it would seem you are right, although I'm a little surprised with the amount of time it's taken to bring this product to market. A quick check on the "way back machine" reviled the product has been in development/beta for over a year!!??
 
http://web.archive.org/web/20060530105937/http://www.clicktale.com/
 
Crazy Egg, on the other hand are doing something totally different; in fact I talked to them a couple of weeks ago and have included their response below:
 

John,
 
Interesting idea Smile | :)
 
At the moment...
 
We are more focused on tracking clicks, than mouse movements, but you have brought up an interesting point.
 
If you have any further feedback, we'd love to hear it.
 
Thanks!
 

Hiten Shah
Crazy Egg

 
I guess the point is, this article contains the “how to” for creating the same functionality; surely that deserves your vote, right?
 
Plus, as a .Net component that allows developers to drag off their toolbar and integrate into existing applications has to be worth something?? Smile | :)

 
"Simplicity is the ultimate sophistication" - Leonardo Da Vinci

GeneralRe: The idea is not new ;))) PinmemberUser of Users Group13 May '07 - 0:44 
For one, this is an overly simplistic view of the web world.
 
Few pointers if I may, numerous suggestions and figures in the article are useless because it makes it more desperate than it should be.
 
Web based chat sessions have been done since at least 1996, using timeouts, frames or RDS, so it is likely you were not first 3 years later. Besides if you patent chat you might as well patent BBS's that ruled this type of communication before Web came in.
 
Anyway, people coming in and advertising their software, free or open-source, or paid for, much like those patent pending comments on these boards are demonstrating nothing but insecurity. Lucky I do not vomit easily, otherwise my desk would be a mess.
 
Third, capturing all the variants of browsers, rendering engine, extensions, resolution, OS-es is infeasible, hence you would only guarantee playback what you could get from User-Agent based assumptions. That is more work than anything else mentioned here.
 
Fourth, people have done it before those two companies I never heard of before applied for patents, could alternate between implementations, add-ins too, and did not use the bloat of XML representation. Seems to me these days every developer with ability to do an HTTP request or HTTP module in ASP.NET (gulp!) or a dynamic page is assuming fame, road to riches and often world control.
 
Frankly you can knock this up in few days tops, assuming IE, CLR and SQL, and see for yourself what happens. You will need not only interpolate or be able to set your implementation and resolution to theirs, your browser instance will be dog slow in suggested approach especially with dynamic pages (although there is a workaround and some unfriendly sites out there use it heavily), but you will have to post back everything any intermediary injects in the browser.
 
Even then, you have security software that makes a lot of normal pages appear useless without this 'extra' in the picture, imagine how useful this injection would be, and imagine how popular that privacy feature would be. Some sites tried to be clever about this, but the blue progress bar or pop-ups always gave them away, that is why AJAX crowd should be taken out and sent to Hague, TODAY, before we have another crack at securing the unsecure.
GeneralRe: The idea is not new ;))) PinmemberJohn-Howard13 May '07 - 7:28 
Hi, thanks for your feedback, I think!
 
Overly simplistic view of the web world… I guess this perception depends on your level of experience. You’re obviously reviewing this article with the understanding I am some newbie .Net developer who’s read a dummies guide to AJAX and is now convinced he can change the world. I can assure you, that’s really not the case.
 
As for desperation, I do see your point only I would describe it more as frustration. Not sure if you ever took a demo of DeskVu/Convea, in a nutshell we produced an application 7 years ago that I guess looking back was way ahead of its time. 7 years on I am yet to see an application come close in terms of true innovation and a demonstration of shear development skills.

It took us 3 years to develop Convea, we had young families and very limited funds and basically slept under our desks sometimes not returning home for weeks at a time, whilst putting together an application we were convinced was truly amazing. Only to wake up one day and read Slashdot to realise that yahoo had just acquired OddPost for close to $30 million I will never forget that feeling, $30,000,000 for an IE based email application, ok it was good but it was still only one application. We had over 30 at that time all running within an intelligent framework, sharing information, each one a commercial application in its own right. even now when I login to a little version I have running here it still impresses me.
 
Realising we had no funds to market the application, we decided to release it open source selling commercial licenses etc. That was the worst mistake we could have made as we suddenly noticed perfect clones appearing with a simple logo and name change as paid services without any permission. We had tried for UK funding with no Joy whilst a Canadian company managed to fraudulently raise $100,000 from an investment company by passing the product off as their own. No matter how much we tried we could not fight back as we simply we had no funds to pay for legal support.
 
Since that time I have seen so many poor (no overstatement) applications such as Calendars, Knowledge Base, Document Management systems appear and be acquired for stupid amounts of money. All touting terms such as AJAX, Thin clients etc, technologies we had been working with since nappies.
 
I guess this article was my attempt at stepping from behind the scenes and publishing a concept, one of which I am sure if developed and marketed correctly could have good potential.
 
I remember we used an email component called JMail during the Convea days. When we decided to release Convea as open source I remember thinking, damn we can not release the email component, so I took it upon myself to create one. I basically wrote the component in 3 days, it was very intelligent and fixed many issues lacking with JMail such as inline image processing etc. The source was then released as part of the Convea open source movement. Some days later I visited the vendor’s website only to discover JMail had sold 100,000 copies at $50 per copy and I had just given my source away for free, thats one component, you do the math.
 
My point is I believe this has potential. Granted there are logic issues that will need more thought but what I am presenting is the concept. I create cross browser code every day as I think most developers do these days. We do not need to rely on huge code libraries as we all know they only introduce bloat. It’s really just a case of giving it some thought, I think it’s naive to think it could not be done elegantly. If I had presented you with the concept of something like Google maps 5 years ago you would have probably provided the same response.
 
As I said, I have Convea running here for reminisce purposes, I would be happy to give you a demo. I can promise you, this old application never fails to impress.
 
Like I said, thanks for your post!

Regards,
 
John
 

 

 
"Simplicity is the ultimate sophistication" - Leonardo Da Vinci

GeneralRe: The idea is not new ;))) PinmemberUser of Users Group14 May '07 - 0:26 
Please do not get me wrong, I believe article is and could be a great starting point.
 
I am not making any assumptions on your experience, but I was rather commenting on constant influx of general input on this site overall. You know the one coming in form of : 'this is not new', 'patent pending', 'got that in VB', 'got that in CSharp', 'got that in MFC', 'this is not new', 'there is my product.com', 'check out that.net'
 
I was only aiming at making the article less 'my cool idea marketing'-like and more in a form of 'business proposal', professional and without the 'look how good I am' hints. The proposal or work should speak for itself or in seperate presentation document or media.
 
And I believe you should fear no patent comments, and especially in Europe at the very least. Even if not, then you always have workarounds, possibility of an entire hurd of prior art claims and more. Thus whether MS has patent on something is probably too much detail.
 
The best Web work probably was done around the time you mention, it rings bells, and I have no doubt your work was leading back then.
 
I often recall seeing people do a lot more than thought possible at that time but only taken as 'wow' today on yahoo or google or those silly 'look ma, mash up, smash up debug JS' sites.
 
And those roots are important while the rest pile in overbloated ASP.NET or JSP or runtime approach.
 
And I can understand what you went through but by no means do I think you should focus on it at all. Past is past, and moving on is more important I would think.
 
I am all up for demos any day. I do them regurarly before bothering with many say web, productivity, architecture, including hu ha nhibernate based solutions and more, and usually they all fall apart rapidly. Or they do not provide anything that was not possible before, even in 'low-level' languages.
 
Yet if you look at their licencing costs it is tragic to find out most of the work was ripped from Code Project in fact. And often not even polished.. It is hard to find good and elegant and economic 'components', it is even harder to find time/money-saving solutions, and hardest to find the work done with true love.
 
So I would be more than happy to view it and even recommend it for what I perceive your work is suitable for. You are not far away from us and UK is flourishing in this space.
 
My point being there is always plenty of web, workflow, documentation and integration work to be done, that is what this industry has become. Not many people go back to the roots and bother, new generation is in that assumes only their software will hammer the machine to the max. Even big vendors do that.
 
You might argue the business side is more ruthless than before, but so there is plenty of tech discussion not focusing on making money (architecture this that, enterprise library, best practices, Folwerism, rest, xml and clr overbloat and more). If it was all that simple and guidance did what it was almost claiming to do, then we would probably not see such fragility or expenses or support costs or fragmentation.
 
Thus I believe if the product is not build with that integratation feature from the outset then the only overlap clients will find is 'bits and pieces' approach to save development (people cost, pro-buy over build) time. And that can work too, it does although not as good from what I have seen or been told about.
 
And for the record, I really like the way you think, styling the article aside (and they are never discussed right? Smile | :)
 
I mean, I like the minimalistic approach you take on, and the reason I bothered with the article is because you said it yourself early on: ajaxiamisms, clr-isms and more are always too cumbersome for the task you need done. They often make it more complex than simple, introduce complexity we do not need, and a huge penalty for the enivornment or solution they are aiming at.
 
I will contact you offline to get a picture of your past work, what it was done in, how easy it is to connect to other systems. Why not? I have seen enough in this article and your explanation to know you have the 'anger' to do better than most. But imagine something does come out of it, we would prefer to focus on technical detail and integration features to immediatelly satisfy business needs rather than 'oh but this idea is real cool', 'it is worth more than xxxx' etc.
 
And that is the type of people you want to work with, not the cut and paste hackers, megalo-abstractionists, or every latest framework release hurd followers. Hope you see where my comment was coming from and what it was aiming at, it was not at all directed at you.
 
And your reply to that provocation of mine was very professional.
 
When you are ready..
GeneralRe: The idea is not new ;))) PinmemberJohn-Howard15 May '07 - 9:06 
Hi,
Thanks for your response.
 
As I said in the article, this was my first post and to be honest more of a late night brain dump. I have so much on at the moment I don’t get the time for any much loved R & D work so thought I would share the concept.
 
I appreciate your comments and kind words, I agree the article could have been styled/worded differently, I guess after sitting behind the scenes for so long observing poor applications receive hype I finally forced myself to speak out, hence the 'my cool idea marketing' pitch Wink | ;-)
 
I did not research the concept past a basic Google search as I was quietly convinced if it did exist it would most likely be bloatware. Plus, as a component SME’s could offer the solution to their clients without paying subscriptions or introducing the dependency of a third party service.
 
I’m always keen to expand my contacts as we never knows what the future holds Smile | :)
 
Thanks again!
 
John
 

 

 
"Simplicity is the ultimate sophistication" - Leonardo Da Vinci

GeneralRe: The idea is not new ;))) [modified] PinmemberUser of Users Group16 May '07 - 10:55 
Oh wow, I knew the old school would just show the way. I love it, and I completely agree the bloat framework, runtime and other pitchers are not aware 1999/00 was the year it was all done already, Ajax, OR/Ms, Enterprise Music and more. Sad to see our machines are 10x more powerful yet still not giving results as good as this.
 
For the record, it was IMPRESSIVE (more so because some providers have not caugh up with it even today) and I look forward to seeing more.
 
This thing is so old yet it rocks, immediate response, reminds me of good ol' (some Google boys now), original service providers.
 
I think I now understand why 'the pitch' can be fully justified.
 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 6 Mar 2008
Article Copyright 2007 by John Doherty
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid