Is it possible to track every action of a user on a webpage and creating log of it? The idea is to transfer log of user actions to server via AJAX and saving it. On each event for each element I can write code/logic to write some log in console, but I was wondering if there is any library/shortcut available which can log all actions on webpage at client side including events and actions such as copy, paste, click, double click, selection etc. with their element reference.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
You can use ready-made solutions:
You can do amazing stuff with Google Analytics and its Event Tracker:
If you're looking for a custom-made solution, you can try the following one with PHP and JavaScript:
Keep in mind that using third-party solutions is better performance-wise. Writing the coordinates of the mouse movements in a database in real time, needs a lot of resources.
I don't think that this kind of javascript library exist, you could easily build one with jquery, just listen to all the event (
blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error
)and than send them to the server side using web sockets
Have you look at Google Analytic Event Tracking?
You need to embed the tracking function within your javascript but it is very convenience to use.
Update: 2017 New Analytics Api