Frappe Activity Tracker
A self-hosted Time Doctor inside Frappe — tracks user activity in Frappe Desk and delivers productivity analytics.
- Author: rbnkoirala
- Repository: https://github.com/rbnkoirala/frappe_activity_tracker
- GitHub stars: 0
- Forks: 0
- Category: Sales & CRM
- Maintenance: Actively Maintained
Install Frappe Activity Tracker
bench get-app https://github.com/rbnkoirala/frappe_activity_tracker
Add the Frappe Gems badge to your README
Maintain Frappe Activity Tracker? Paste this into your README:
[](https://frappegems.com/gems/apps/rbnkoirala/frappe_activity_tracker)
About Frappe Activity Tracker
frappeactivitytracker
A self-hosted Time Doctor inside Frappe — tracks user activity in Frappe Desk and delivers productivity analytics.
Features
| Feature | Details |
|---|---|
| Active-time tracking | Counts only real interaction time (click, keypress, mousemove, scroll) |
| Idle detection | 60-second idle threshold; hidden tabs never accumulate time |
| Multi-tab safety | Leader-election via localStorage — only one tab tracks at a time |
| Batch API | Logs sent in bulk every 2 minutes; retried on network failure |
| Route awareness | Detects Form / List / Report / Workspace / Page automatically |
| Productivity Summary | Daily active vs idle time + productivity score (%) per user |
| Timesheet Auto Log | Daily hours broken down by DocType, generated by a background job |
| 5 built-in reports | Time Per Doctype, Time Per Report, Time Per User, Productivity Score, Daily Work Hours |
App Structure
frappe_activity_tracker/
├── frappe_activity_tracker/ # Python package
│ ├── hooks.py # App hooks & scheduler config
│ ├── api.py # track_time() whitelist API
│ ├── tasks.py # Daily background jobs
│ ├── public/js/tracker.js # Front-end tracker (injected into Desk)
│ └── frappe_activity_tracker/ # Frappe module
│ ├── doctype/
│ │ ├── user_activity_log/
│ │ ├── productivity_summary/
│ │ └── timesheet_auto_log/
│ └── report/
│ ├── time_per_doctype/
│ ├── time_per_report/
│ ├── time_per_user/
│ ├── productivity_score_per_user/
│ └── daily_work_hours/
├── setup.py
├── requirements.txt
└── MANIFEST.in
Installation
Prerequisites
- Frappe bench set up with a site (v15+ recommended)
- Python 3.10+
Installation Process
# From your bench directory
bench get-app https://github.com/rbnkoirala/frappe_activity_tracker
bench --site install-app frappe_activity_tracker
bench --site migrate
bench --site enable-scheduler
Ensure your bench workers are running so the daily scheduler jobs execute.
DocTypes
User Activity Log
Stores one row per tracked route segment.
| Field | Type | Description |
|---|---|---|
| user | Link → User | Authenticated user |
| session_id | Data | Frappe session SID |
| route | Data | /app/... path |
| view_type | Select | Form / List / Report / Workspace / Page |
| ref_doctype | Link → DocType | DocType being viewed |
| docname | Data | Document name (Form view) |
| active_time | Int | Active seconds in this segment |
| idle_time | Int | Idle seconds in this segment |
Indexes: (user, creation), (ref_doctype), (route)
Productivity Summary
Aggregated daily record per user.
| Field | Type |
|---|---|
| user | Link → User |
| date | Date |
| totalactivetime | Int (s) |
| totalidletime | Int (s) |
| productivity_score | Float (%) |
Timesheet Auto Log
Daily hours per user, broken down by DocType.
| Field | Type |
|---|---|
| user | Link → User |
| date | Date |
| total_hours | Float |
| doctype_breakdown | Long Text (JSON) |
| report_breakdown | Long Text (JSON) |
Background Jobs
Both run daily via hooks.py → scheduler_events:
frappe_activity_tracker.tasks.compute_productivity_summaryfrappe_activity_tracker.tasks.generate_timesheet_logs
API
frappe_activity_tracker.api.track_time
Accepts a JSON array of log entries:
[
{
"route": "/app/Sales Invoice/SI-0001",
"view_type": "Form",
"ref_doctype": "Sales Invoice",
"docname": "SI-0001",
"active_time": 120,
"idle_time": 30
}
]
userandsession_idare injected server-side.- Entries with
active_time < 10are silently discarded.
License
MIT
Related Sales & CRM apps for Frappe & ERPNext
- Crm — Fully featured, open source CRM
- Flow — Frappe Flow — native AI agents, tools, and triggers for Frappe
- Sales Kpi — Sales KPI app for ERPNext
- Crm Override — An example Frappe app that demonstrates how to override Frappe UI based apps.
- Eseller Suite — A comprehensive frappe app designed to help selling partners thrive on various online platforms like Amazon and Flipkart. With powerful tools for optimization, analytics, and automation, sellers can boost sales, optimize listings, and stay ahead of the competition effortlessly.
- Sales Prediction — AI-powered sales forecasting using Prophet
- Dlitscustom — Erpnext Custom Pricing rule , commission , tools etc..
- Van Sales Pwa — Van Sales PWA: field sales app (customers, invoicing, payments, stock) with backend and frontend source in one app (like HRMS or POS Awesome). Install on any site, build, and open /pwa.