Click here to Skip to main content
13,665,166 members
Rate this:
Please Sign up or sign in to vote.
I want to track all activity of registered user (user already created a account in web application) on a webpage like where he clicked (not a postback event used onclick of anchor), what text he searched (like filter of records etc), how much time spend on a webpage without using any third party tool (try to do this in JavaScript, JQuery, .net using c#). 

What I have tried:

I tried to create a service which called on a page_load event of all pages or may be in master but unable to do clients side events.
Posted 21-Feb-17 1:56am
Updated 23-Feb-17 0:50am
ppolymorphe 22-Feb-17 3:29am
"Big Brother" site ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yeah, you can't do this from C# code. ASP.NET code runs ENTIRELY server-side. It has absolutely no access to the client at all.

If you're looking for stuff like where on the page a user clicked you MUST use client-side scripting to do it and send that information however you want to whatever logging server you write.
chetna2810 21-Feb-17 23:53pm
Thanks for your response. I got the point. Kindly tell me the way how to do this by using JavaScript or JQuery. I just want to count the no of clicks done.(Ex:- I have used onclick event in anchor).
Also a humble thanks in advance.
Dave Kreskowiak 22-Feb-17 9:03am
I have no idea how to do it. Client-side script is not my strong suit.
chetna2810 23-Feb-17 2:01am
Okk Thanks..
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

As Dave said, you would have to use JavaScript. Theoretically, when your page has loaded you could hook into all the relevant tags and add an event listener to each one (hint JavaScript provides an addEventListener that you would need to use). There are restrictions with this approach though, depending how you hook it up; primarily that you may find that addEventListener listens for events bubbling up (e.g., if you added it to the document to listen for click events), so if something causes the event not to bubble then you won't catch it.
chetna2810 27-Feb-17 2:23am
Thanks for your reply. I will try to use 'addEventListener'.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180810.1 | Last Updated 23 Feb 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100