A real-time mouse movement tracking and heatmap visualization tool. Track your mouse movements across a webpage and generate beautiful heatmap visualizations to analyze user interaction patterns.
- Real-time Mouse Tracking: Track mouse movements in real-time through WebSocket connections
- Start/Stop Recording: Control when to start and stop recording mouse movements
- Manual Heatmap Generation: Generate heatmaps on-demand with timestamped filenames
- Connection Status Monitoring: Visual indicators showing the status of all WebSocket connections
- Modern UI: Clean, responsive interface with a navigation bar and status indicators
The project consists of three main components:
- Frontend (Browser): HTML/CSS/JavaScript client that tracks mouse movements
- Node.js Server: Middleware server that bridges the browser and Python backend
- Python Backend: Processes mouse data and generates heatmap visualizations
Browser β Node.js Server β Python Backend
β β β
Mouse WebSocket Heatmap
Tracking Proxy Generation
- Node.js (v14 or higher)
- Python (3.8 or higher)
- npm (comes with Node.js)
cd mouse-heatmapcd node
npm installcd ../python
pip install -r requirements.txtOr install with user flag if you encounter permission issues:
pip install --user -r requirements.txtYou need to run both servers simultaneously. Open two terminal windows:
cd node
node server.jsYou should see:
HTTP server on http://localhost:3000
Browser WS on ws://localhost:3001
cd python
python app.pyYou should see:
Python WS on ws://localhost:5000
-
Open your browser and navigate to
http://localhost:3000 -
Check Connection Status: The top navigation bar shows:
- Browser β Node.js connection status
- Node.js β Python connection status
-
Start Recording: Click the "
βΆοΈ Start Recording" button -
Move Your Mouse: Move your mouse around the webpage to record movements
-
Stop Recording: Click the "βΉοΈ Stop Recording" button when done
-
Generate Heatmap: Click the "π₯ Generate Heatmap" button to create a visualization
-
View Results: The heatmap will be saved in the
python/directory with a timestamped filename (e.g.,heatmap_2026-01-11_15-35-50.png)
mouse-heatmap/
βββ node/
β βββ server.js # Node.js WebSocket server
β βββ package.json # Node.js dependencies
β βββ node_modules/ # Installed packages
βββ python/
β βββ app.py # Python WebSocket server & heatmap generator
β βββ requirements.txt # Python dependencies
β βββ heatmap_*.png # Generated heatmap files
βββ public/
β βββ index.html # Frontend application
βββ README.md # This file
The default heatmap size is 1920x1080 pixels. You can modify this in python/app.py:
WIDTH = 1920
HEIGHT = 1080- HTTP Server:
3000(Node.js) - Browser WebSocket:
3001(Node.js) - Python WebSocket:
5000(Python)
To change ports, modify the respective server files.
- HTML5
- CSS3 (with modern gradients and animations)
- Vanilla JavaScript (WebSocket API)
- Node.js: Express.js for HTTP server,
wsfor WebSocket server - Python:
websocketsfor WebSocket servernumpyfor data processingmatplotlibfor heatmap visualization
- Heatmap files are automatically ignored by git (see
.gitignore) - Each generated heatmap includes a timestamp in the filename for easy identification
- The application only records mouse movements when recording is active
- Heatmaps are only generated when you manually click the "Generate Heatmap" button
- Make sure the Python server is running
- Check that port 5000 is not in use by another application
- Verify Python dependencies are installed correctly
- Ensure you've started recording and moved your mouse
- Check the browser console (F12) for error messages
- Verify both Node.js and Python servers are running
- For Python: Run
pip install -r requirements.txtin thepython/directory - For Node.js: Run
npm installin thenode/directory
This project is open source and available for personal and educational use.
Feel free to submit issues, fork the repository, and create pull requests for any improvements.
Happy Tracking! π―