Skip to content

tizee-tampermonkey-scripts/tampermonkey-x-history-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

X History Tracker

A Tampermonkey userscript that automatically tracks visited X/Twitter posts with frecency-based scoring for easy retrieval.

Problem

Posts you've seen on X but didn't Like or Bookmark are nearly impossible to find later. Searching by vague memory is painful.

Solution

This script silently records every status page you visit, storing the URL and a title summary (from og:title meta tag) in localStorage. Entries are ranked by frecency -- a combination of visit frequency and recency -- so the posts you visit often and recently always float to the top.

Features

  • Automatic tracking -- Detects SPA navigation via pushState/replaceState interception. No manual action required.
  • Frecency ranking -- Inspired by z (jump) / autojump. Score = visits * 2^(-age / half_life). Recent + frequent = highest rank.
  • Deduplication -- URLs are normalized to https://x.com/{user}/status/{id}. Revisits increment the counter and refresh the title.
  • Title extraction -- Reads <meta property="og:title"> with retry logic (up to 6 attempts, 1s apart) to handle SPA async updates.
  • Browsable history panel -- Search/filter by title or URL, sorted by frecency score. Click to open, hover to delete.
  • Configurable settings -- Max entries cap and frecency half-life, adjustable via the Settings tab.
  • Export -- One-click JSON export of all tracked entries with scores.
  • Danger zone -- Clear all history with two-step inline confirmation.

Install

  1. Install Tampermonkey
  2. Create a new script and paste the contents of user.js
  3. Visit any post on x.com -- tracking starts automatically

Usage

View History

Tampermonkey menu > View History

Opens a panel with two tabs:

History tab

  • Search bar to filter by title or URL
  • Entries sorted by frecency score (shown on the left)
  • Click an entry to open in a new tab
  • Hover to reveal the delete button
  • Export button to download as JSON

Settings tab

  • Max entries -- Slider (50-1000) or manual input (10-5000). Lowest-frecency entries are evicted when exceeded.
  • Frecency half-life -- Slider (1-30 days). Lower values make recent visits dominate. Higher values let older entries persist.
  • Danger Zone -- Clear all history with two-step confirmation.

Changes take effect after clicking Save Settings.

Export

Tampermonkey menu > Export History (JSON) for quick export without opening the panel.

How Frecency Works

score = visits * 2^(-age / half_life)
Scenario visits age half_life=7d score
Visited once, just now 1 0 7d 1.0
Visited 5 times, 1 day ago 5 1d 7d 4.5
Visited 10 times, 14 days ago 10 14d 7d 2.5
Visited once, 30 days ago 1 30d 7d 0.05

Posts you visit frequently and recently rank highest. Old, rarely-visited posts naturally sink and get evicted when the cap is reached.

Storage

  • History data -- localStorage key x-history-tracker (stays within x.com origin)
  • Settings -- GM_setValue key x-history-tracker-settings (persisted by Tampermonkey)

License

MIT

About

x history tracker

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors