Analysis of Visual Interest of Visitors on a Website
Hello, in this my blog post I will tell you how to analyze the interest of visitors on websites with mouse movements.
Analysis of the visitor's mouse movements and click information gives us clues about where the ads to be added to the website will be placed. By determining how much time the visitor spends on which page and in which areas, we can both add special ads to users and enable users to interact with the ads
Detecting Mouse Movements
In order to detect and record mouse movements, we need commands to run both on the client side and on the server side. On the client side, the mouse coordinates of the visitor should be sent to our server with a POST Request, and on the server side, the information coming from the client should be saved in the database. On the client side,Javascript is used to transfer information to the server . On the server side, Python-Flask is used to detect requests from the client and to save data in the database.
Detecting Mouse Coordinates on Client Side and Sending to Server
XMLHttpRequest is a built-in JavaScript object used to pass data between a server and a client without refreshing the entire page.
Using XMLHttpRequest we can update the page based on user action.
For example, an endless stream of news. (When the user scrolls to the bottom of the page, we make a request to fetch the next article and insert the data into the page). Using XMLHttpRequest we can make both synchronous and asynchronous requests.
To briefly explain the code below, mouse coordinates are determined using document.onmousemove and if there is a new mouse coordinate detected, after making the necessary settings for XMLHttpRequest, you can set the mouse coordinates with the post request to your website as JSON format.
Registering incoming data servers by the client
On the server side, if our request from the client is a POST request, we match the content with the relevant tags and save it to the database.
Visualization of Data
View All Blog PostsIf you want to review my project on Github and want to read my article on medium. You can click the links in the below
Github Link:Github
Medium Link:Medium