YouTube Watch Tracker v1.4

Tracks YouTube session time, video watch time, daily/monthly stats, with export/import support and toggle UI.

作者
Vvoidddd
日安装量
0
总安装量
5
评分
0 0 0
版本
1.4
创建于
2025-06-27
更新于
2025-06-28
大小
8.1 KB
许可证
CC-BY-ND-4.0
适用于

YouTube Watch Tracker v1.4

Track exactly how you spend time on YouTube—with full privacy and local-only storage.


What It Tracks

  • Session Time – How long you've spent on any YouTube tab (including browsing)
  • Life Wasted – Time actively spent watching videos (not paused or inactive)
  • Watched Count – Increments each time a new video starts
  • Daily and Monthly Stats – Usage stats broken down by day and by month
  • Import/Export – Save and restore your data in JSON format
  • Collapsible Sidebar – Toggle the floating tracker panel open or closed with a slide animation
  • SPA Navigation Support – Tracks correctly when navigating YouTube without full page reloads


Storage Snippet Explained


// Save data locally as JSON string under a unique key
localStorage.setItem(STORAGE_KEY, JSON.stringify(data));

// Load and parse data from localStorage safely
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
    try {
        data = JSON.parse(stored);
    } catch (e) {
        data = {}; // fallback if parsing fails
    }
}

Explanation:

  • localStorage.setItem stores data only in your browser, never transmitting it
  • STORAGE_KEY is a unique key for this script's data
  • JSON.stringify converts the data object into a string for storage
  • localStorage.getItem retrieves the stored string
  • JSON.parse converts the string back into a JavaScript object
  • Error handling ensures corrupted data doesn’t break the script

This script does not connect to any server or send your data anywhere. Your privacy is fully respected. Of course, the only other entities with your data are you... and your ISP. So choose your videos wisely.


How To Use

  1. Install via Tampermonkey or a similar userscript manager
  2. Visit YouTube.com
  3. The stats panel appears in the top-right corner
  4. Click the arrow to collapse or expand the panel with a smooth slide animation
  5. Click Export to copy your usage data as JSON
  6. Click Import to paste previously saved data and restore your stats


Changelog

  • v1.4 – Added SPA navigation support, fixed video watch detection, reset timers on new video
  • v1.3 – Added collapsible sidebar UI with slide animation and toggle arrow
  • v1.2 – Daily/monthly stats, import/export, improved time tracking
  • v1.1 – Fixed paused/idle video time tracking issues
  • v1.0 – Initial release with video count and total time tracking


License


CC-BY-ND-4.0 – Free to use as-is. Modification or redistribution of derivative works is prohibited. Attribution to @Vvoidddd required.


QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址