No description
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-20 13:17:05 +00:00
.gitignore Init: ChatGPT thread first-seen URL tagger Tampermonkey script 2026-10-20 12:39:43 +00:00
LICENSE Init: ChatGPT thread first-seen URL tagger Tampermonkey script 2026-10-20 12:39:43 +00:00
link-updater.user.js Bump version to 1.6.1 2026-10-20 13:17:05 +00:00
README.md Init: ChatGPT thread first-seen URL tagger Tampermonkey script 2026-10-20 12:39:43 +00:00

ChatGPT Thread First Seen (URL Tagger)

A Tampermonkey userscript that automatically tracks the first time you visit a ChatGPT thread and appends a timestamp plus the thread's title to the URL—no page reload required.

Features

  • Automatic first-visit tracking: Records the first time you visit each ChatGPT thread (Unix timestamp)
  • URL tagging: Appends date, time, and sanitized thread title as query parameters
  • No reload: Uses history.replaceState() to update the URL without navigation
  • Persistent storage: Uses Tampermonkey's GM_setValue and GM_getValue to store timestamps locally
  • SPA-aware: Monitors URL changes, title changes, and history events to detect navigation
  • Clean parameter ordering: Maintains consistent query parameter order (title → date → time → timestamp)

Installation

  1. Install the Tampermonkey browser extension
  2. Click the Tampermonkey icon and select "Create a new script"
  3. Copy the contents of link-updater.user.js and paste it
  4. Save and enable the script
  5. Visit ChatGPT and open any thread—the URL will automatically update with tracking parameters

Auto-Update (Optional)

To enable auto-updates, configure your Tampermonkey script manager:

  • Set the @downloadURL metadata pointing to where you host this file
  • Set the @updateURL metadata pointing to the same location
  • Tampermonkey will periodically check for updates

How It Works

  1. Thread Detection: Recognizes ChatGPT thread URLs (pattern /c/<thread-id>)
  2. First-Visit Tracking: Stores the first visit timestamp in browser storage with key cg_thread_first_seen_v1
  3. Title Extraction: Reads the current page title and sanitizes it:
    • Replaces spaces with hyphens
    • Removes non-alphanumeric characters (except hyphens)
    • Removes leading/trailing hyphens
  4. URL Update: Appends four query parameters:
    • title: Sanitized thread title
    • first_seen_date: Date in YYYY-MM-DD format
    • first_seen_time: Time in HH.MM format
    • first_seen_timestamp: Unix timestamp (seconds)
  5. History Hooks: Intercepts history.pushState() and history.replaceState() to detect navigation and re-run tagging

Storage

The script stores data using Tampermonkey's sandboxed storage (per-domain):

{
  "thread-id-1": { "first_seen_unix_s": 1697000000 },
  "thread-id-2": { "first_seen_unix_s": 1697100000 }
}

To clear stored timestamps, open Tampermonkey's dashboard → Storage → delete the cg_thread_first_seen_v1 key.

Requirements

  • Tampermonkey extension (browser: Chrome, Firefox, Edge, Safari)
  • ChatGPT access at https://chatgpt.com/

Compatibility

  • Chromium-based browsers: Chrome, Edge, Brave, Opera (with Tampermonkey)
  • Firefox: With Tampermonkey extension
  • Safari: With Tampermonkey extension

Usage Example

  1. Visit: https://chatgpt.com/c/abc123xyz
  2. The script detects the thread ID and first visit
  3. URL automatically becomes: https://chatgpt.com/c/abc123xyz?title=How-to-learn-Python&first_seen_date=2026-10-20&first_seen_time=14.35&first_seen_timestamp=1729432500
  4. Visiting the same thread again later will preserve the original first-visit timestamp

License

MIT License

Author

Created with assistance from ChatGPT.