From 8dcd4e8502373bf87354fc15629369c0808b3b11 Mon Sep 17 00:00:00 2001 From: mechahakv Date: Sun, 15 Mar 2026 12:24:06 +0530 Subject: [PATCH 1/4] new project created --- Chahak Agrawal/README.md | 14 + Chahak Agrawal/admin-login.html | 20 ++ Chahak Agrawal/admin.html | 476 ++++++++++++++++++++++++++++++++ Chahak Agrawal/index.html | 56 ++++ Chahak Agrawal/tracker.js | 89 ++++++ 5 files changed, 655 insertions(+) create mode 100644 Chahak Agrawal/README.md create mode 100644 Chahak Agrawal/admin-login.html create mode 100644 Chahak Agrawal/admin.html create mode 100644 Chahak Agrawal/index.html create mode 100644 Chahak Agrawal/tracker.js diff --git a/Chahak Agrawal/README.md b/Chahak Agrawal/README.md new file mode 100644 index 00000000..b10a8f73 --- /dev/null +++ b/Chahak Agrawal/README.md @@ -0,0 +1,14 @@ +# About Project + +Bascic frontend project. +It tracks activity on user page-like clicks,time spent,no of sessions,time sepnt per sections,etc. +It stores all the activity in the admin side . + +# Files in the project + +index.html-sample user page-where actuvity is going to tracked||| +admin-login.html-a page to login as admin||| +admin.html-the admin page that shows the dsahboard for all the activities done at index(i,e; user page) with different features for anylaysis of the all the data||| +tracker.js-handling the working of the features + + diff --git a/Chahak Agrawal/admin-login.html b/Chahak Agrawal/admin-login.html new file mode 100644 index 00000000..e9cd6d0c --- /dev/null +++ b/Chahak Agrawal/admin-login.html @@ -0,0 +1,20 @@ + + +Admin Login + +

🔐 Admin Login

+ + + + + + diff --git a/Chahak Agrawal/admin.html b/Chahak Agrawal/admin.html new file mode 100644 index 00000000..fa835f6d --- /dev/null +++ b/Chahak Agrawal/admin.html @@ -0,0 +1,476 @@ + + + + + + User Behavior Dashboard + + + + + + + + +
+

📊 User Behavior Dashboard

+ + + +
+
+ + +
+ +
+ + +
+
+ +
+ + +
+ + +
+ +
+ + +
+

🕒 Time Spent per Section

+ +
+ +
+

📍 Combined User Behavior (Flagged Outliers)

+ +
+

🚩 Flagged Users

+ + + + + + + + +
User IDBehavior Score
+ + +
+

👥 Aggregated User Behavior

+
+
+ + + +
+ + + + + + + + diff --git a/Chahak Agrawal/index.html b/Chahak Agrawal/index.html new file mode 100644 index 00000000..d703d8c3 --- /dev/null +++ b/Chahak Agrawal/index.html @@ -0,0 +1,56 @@ + + + + + Behavior Tracker Demo + + + + +

Welcome to the Tracking Demo

+ + +
+ + + +
+ + +
Home Section
+
About Section
+
Contact Section
+ + + + + diff --git a/Chahak Agrawal/tracker.js b/Chahak Agrawal/tracker.js new file mode 100644 index 00000000..99589c03 --- /dev/null +++ b/Chahak Agrawal/tracker.js @@ -0,0 +1,89 @@ +class UserBehaviorTracker { + constructor(username) { + this.username = username; + this.clicks = []; + this.typing = []; + this.scrolls = []; + this.sectionTimes = {}; + this.idleTime = 0; + this.lastInteraction = Date.now(); + this.typingStart = null; + this.activeSection = null; + this.sectionStartTime = null; + + this._startIdleTimer(); + this._setupListeners(); + this._savePeriodically(); + } + + _startIdleTimer() { + setInterval(() => { + const now = Date.now(); + if (now - this.lastInteraction > 5000) { + this.idleTime += 1; + } + }, 1000); + } + + _setupListeners() { + document.addEventListener('click', e => { + this.clicks.push({ x: e.clientX, y: e.clientY, time: new Date().toISOString() }); + this.lastInteraction = Date.now(); + }); + + document.addEventListener('keydown', e => { + const now = Date.now(); + this.typing.push({ + key: e.key, + delay: this.typingStart ? now - this.typingStart : 0, + time: new Date().toISOString() + }); + this.typingStart = now; + this.lastInteraction = now; + }); + + window.addEventListener('scroll', () => { + this.scrolls.push({ scrollY: window.scrollY, time: new Date().toISOString() }); + this.lastInteraction = Date.now(); + }); + + this._observeSections(); + } + + _observeSections() { + const sections = document.querySelectorAll('section'); + const observer = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting) { + const id = entry.target.id; + if (this.activeSection && this.sectionStartTime) { + const duration = (Date.now() - this.sectionStartTime) / 1000; + this.sectionTimes[this.activeSection] = (this.sectionTimes[this.activeSection] || 0) + duration; + } + this.activeSection = id; + this.sectionStartTime = Date.now(); + } + }); + }, { threshold: 0.5 }); + + sections.forEach(sec => observer.observe(sec)); + } + + _savePeriodically() { + setInterval(() => { + const data = { + username: this.username, + clicks: this.clicks, + typing: this.typing, + scrolls: this.scrolls, + sectionTimes: this.sectionTimes, + idleTime: this.idleTime + }; + const sessionId = `session-${this.username}-${new Date().toISOString()}`; + + localStorage.setItem(sessionId, JSON.stringify(data)); + }, 10000); + } +} + + From 5c357d24e31c59215c485038b6a00d449cace3e8 Mon Sep 17 00:00:00 2001 From: mechahakv Date: Sun, 15 Mar 2026 12:25:41 +0530 Subject: [PATCH 2/4] project name added --- Chahak Agrawal/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Chahak Agrawal/README.md b/Chahak Agrawal/README.md index b10a8f73..a050b8db 100644 --- a/Chahak Agrawal/README.md +++ b/Chahak Agrawal/README.md @@ -1,5 +1,7 @@ # About Project +UBA-User Beaviour Analysis + Bascic frontend project. It tracks activity on user page-like clicks,time spent,no of sessions,time sepnt per sections,etc. It stores all the activity in the admin side . From 753c28f2635ec8d96a702f0b5a652583f836d498 Mon Sep 17 00:00:00 2001 From: mechahakv Date: Sun, 15 Mar 2026 12:28:59 +0530 Subject: [PATCH 3/4] final updation --- Chahak Agrawal/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Chahak Agrawal/README.md b/Chahak Agrawal/README.md index a050b8db..2e0cdd05 100644 --- a/Chahak Agrawal/README.md +++ b/Chahak Agrawal/README.md @@ -13,4 +13,8 @@ admin-login.html-a page to login as admin||| admin.html-the admin page that shows the dsahboard for all the activities done at index(i,e; user page) with different features for anylaysis of the all the data||| tracker.js-handling the working of the features +# Tech Used +HTMl +JS + From 49fcf41b16133c0222d986d855e0ac93403d868a Mon Sep 17 00:00:00 2001 From: mechahakv Date: Sun, 15 Mar 2026 12:30:38 +0530 Subject: [PATCH 4/4] correcting description --- Chahak Agrawal/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chahak Agrawal/README.md b/Chahak Agrawal/README.md index 2e0cdd05..a6970ae1 100644 --- a/Chahak Agrawal/README.md +++ b/Chahak Agrawal/README.md @@ -8,7 +8,7 @@ It stores all the activity in the admin side . # Files in the project -index.html-sample user page-where actuvity is going to tracked||| +index.html-sample user page-where actuvity is going to be tracked||| admin-login.html-a page to login as admin||| admin.html-the admin page that shows the dsahboard for all the activities done at index(i,e; user page) with different features for anylaysis of the all the data||| tracker.js-handling the working of the features