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.
Ways to Track User Activity on a WebsiteTools like Google Analytics and Search Console. Click tracking (recording which elements on a page users click) Scroll tracking (recording where users scroll on a page) Viewing session recordings of users as they use their site.
Session Recordings. The best way to actually SEE how your users interact with your app is to track user behaviour – that's where session recordings come in handy. Session recordings show you exactly how users interact with your app from the moment they launch it for the first time until they leave the app.
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.
Personally I hate 3rd party like google analytics and similar company. Because I dont want to share my web analytics with them. Anyway there is a very very lightweight (about 5KB minified) and easily extendable javascript library.
Here is git repo: https://github.com/greenstick/interactor and you can see a preview of it: http://greenstick.github.io/interactor/
What Data is Provided?
General Data:
Interaction / Conversion Data:
Example:
var elementsToTrack = [
{
element: "element1",
events : ["mouseup", "touchend"]
},
{
element: "element2",
events : ["mouseup"]
},
{
element: "element3",
events : ["mouseup"]
}
];
for (var i = 0; i < elementsToTrack.length; i++) {
var e = elementsToTrack[i];
new Interactor({
interactionElement : e.element,
interactionEvents : e.events
});
}
I Hope this information will be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With