Webpage Time Limiter is a userscript for desktop Chrome and Safari. It sets a daily time limit for each site you choose, counts only the time you actually spend on the page, and nudges harder the longer you stay past the limit. It has no account, no extension store and no server. It is part of the Useful Tools collection.
What it does
- A limit per site. Three sites are ready from the start: YouTube Shorts (15 minutes a day), Instagram Reels (15 minutes) and X (30 minutes). You can add any site, and limit it to one part of the site, for example only
/shorts. - A badge. On a tracked page, a badge at the bottom right shows the time used and the limit:
YouTube Shorts · 0:00 / 15:00. It is dimmed below 50% of the limit. - Nudges that grow. Past the limit, an overlay appears. Further past, it gets harder to dismiss, and at 150% of the time the page turns gray and videos pause.
- A badge menu. Click the badge to see today’s time and limit for each site with a 7-day trend, to reset the counter of the current site, or to grant yourself 10 more minutes on purpose. In Chrome, the same three commands are also in the Tampermonkey menu.
- A day that starts at 04:00. The counters reset at 04:00 local time, not at midnight.
- History. The script keeps 14 days of totals per site.
How time is counted
Time with a tab open is not useful, because a background tab collects hours. One second counts only when all four conditions are true:
- The tab is visible.
- The browser window has the focus. If another application has the focus, the clock stops.
- You used the mouse, the keyboard or the scroll wheel in the last 60 seconds, or a video plays on the page.
- The address matches one of your sites.
Only one tab is visible and focused at a time, so two tracked tabs cannot count twice. The clock measures time from real timestamps and limits one step to two seconds, so a closed laptop adds no hours.
The escalation ladder
The ratio is the time used on a site divided by the limit of that site. Each site climbs its own ladder, so a site over its limit does not change the behaviour of another site.
| Ratio | Behaviour |
|---|---|
| Below 50% | Badge at the bottom right, dimmed |
| 50% or more | Badge at full opacity |
| 100% or more | The badge turns red and a full-screen overlay appears. Dismiss works at once |
| 125% or more | Overlay, and Dismiss works only after 5 seconds |
| 150% or more | Overlay, the page turns gray and every video pauses |
Dismiss hides the overlay for 5 minutes on that site. The badge stays visible.
Install it in Chrome
- Install Tampermonkey in Chrome.
- Open webpage-time-tracker.user.js on GitHub and click Copy raw file.
- Click the Tampermonkey icon in the toolbar, then Dashboard, then + (create a new script).
- Delete the template text, paste the script and save it.
- Open
youtube.com/shorts. The badge appears at the bottom right:YouTube Shorts · 0:00 / 15:00.
If no badge appears, open chrome://extensions, click Details on Tampermonkey and check that user scripts are allowed.
Install it in Safari
Safari needs its own build. Do not install the Chrome file in Safari.
- Install Userscripts from the Mac App Store. It is free.
- Enable it in Safari → Settings → Extensions.
- Open webpage-time-tracker.safari.user.js on GitHub and click Copy raw file.
- Open the Userscripts popup in the Safari toolbar and create a new script.
- Paste the script and save it.
- Open a tracked site, for example
youtube.com/shorts. The badge appears at the bottom right.
Then do two quick checks, one time:
- Storage works. In Safari → Settings → Advanced, enable Show features for web developers. On a tracked site, open Develop → Show JavaScript Console and reload the page. There must be no
[wtt] GM storage unavailablewarning. - Counts persist. Stay about 60 seconds on a tracked site and move the mouse. Reload the page. The badge must continue from about the same time, not from zero.
Before you reinstall, delete the old script in Userscripts. An old copy with the same name hides the new one.
Change your sites (optional)
The script works without this step. To add, edit or remove sites, run the small settings app. It needs Python 3.11 or later, uv and git.
git clone https://github.com/neiro-data/useful-tools.git
cd useful-tools/webpage-time-tracker-app
uv sync
uv run wtt-config
- The window lists your sites with their icon, domain, path and limit. Use Add, Edit and Remove, then save.
- While the window is open, it shares the list at
http://127.0.0.1:8787/config.json, on your own machine only. The script reads it at most once every 30 seconds and keeps a copy, so the app does not have to stay open. - An open tab picks up a changed limit within 30 seconds. A site that you just added needs a reload of its tab.
- In Safari, macOS can ask for Local Network access. Allow it in System Settings → Privacy & Security → Local Network → Safari.
- The Suggest button fills in the address patterns for a new domain. It uses a small built-in table first. If the table has no answer, it asks Claude through the Claude Code CLI, if you have it installed and logged in.
The other settings live in ~/.webpage-time-tracker/config.json: the inactivity limit (60 seconds), the snooze time (5 minutes), the hour the day starts (4) and the days of history (14).
Limits
- This is a speed bump, not a lock. You can switch off the userscript host in two clicks.
- Desktop only. Mobile browsers cannot run it.
- A new site needs a tab reload.
- A rename resets the history of that site, because the name is the key of the stored counter.
How it was built
The userscript is plain JavaScript with no dependencies and no bundler. One shared core holds all the behaviour, and a thin adapter for each browser handles storage, the network call and the menu. A small Python build script, with the standard library only, joins them into the two installable files. A test fails if those files are older than the source.
- Settings app: Python with Tkinter,
ruffand strictmypy. - 161 pytest tests.
- Built with Claude Code, with specialist agents on most changes. Each change had its own branch and pull request, and I reviewed and merged each one myself.
Links
Code: github.com/neiro-data/useful-tools/webpage-time-tracker-app
Collection: Useful Tools