I am developing a website in ASP.net and I would like to be able to track the mouse movements whilst a user of the site is browsing pages on the site and be able to store the duration in seconds of how long the cursor is left in specific areas on the user's screen (blocks of areas on the screen) back in my site's database.

Is there a .net class which can handle this or can I only do this in JavaScript or AJAX?

I am sure that mouse tracking can be done in Javascript but I can't really store the positions and times collected to my database in the background without interrupting the user whilst he is browsing around the site.

Can anybody please shed some light on this or refer me to some example code which does exactly this?

Thanks,
Matthew

Recommended Answers

All 3 Replies

Thanks for your reply adatapost, however those 2 sites are useless to me.

I only would like to track and store the mouse cursor positions and time durations in seconds on normal/standard user browsers and don't need to use DOM.

If anybody else has any better ideas or links, I would really appreciate it if you could give a helping hand.

Thanks,
Matthew

Thanks for your reply adatapost, however those 2 sites are useless to me.

I only would like to track and store the mouse cursor positions and time durations in seconds on normal/standard user browsers and don't need to use DOM.

If anybody else has any better ideas or links, I would really appreciate it if you could give a helping hand.

Thanks,
Matthew

Sounds like you're looking to have JavaScript mouseover + mouseout call a WCF web service which logs your data to the DB. Here's two links that WILL help you:

Check for Mouseover and Mouseout on here:
http://www.quirksmode.org/js/events_mouse.html

Calling a WCF service from JavaScript:
http://dotnetbyexample.blogspot.com/2008/02/calling-wcf-service-from-javascript.html

With those two you should be able to accomplish what you're trying to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.