Twitter/X Usage Timer

Shows a timer on Twitter/X to track time spent on the site

As of 2025-03-12. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Twitter/X Usage Timer
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Shows a timer on Twitter/X to track time spent on the site
// @author       Drewby123
// @match        https://twitter.com/*
// @match        https://x.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // Create the timer element
    const timerBox = document.createElement('div');
    timerBox.id = 'x-timer-overlay';
    timerBox.style.position = 'fixed';
    timerBox.style.bottom = '20px';
    timerBox.style.right = '20px';
    timerBox.style.background = 'rgba(0, 0, 0, 0.7)';
    timerBox.style.color = '#fff';
    timerBox.style.padding = '10px 14px';
    timerBox.style.borderRadius = '10px';
    timerBox.style.fontFamily = 'monospace';
    timerBox.style.fontSize = '14px';
    timerBox.style.zIndex = '9999';
    timerBox.style.boxShadow = '0 2px 8px rgba(0,0,0,0.5)';
    timerBox.textContent = 'Time on X: 00:00';

    document.body.appendChild(timerBox);

    // Start timer
    let seconds = 0;

    setInterval(() => {
        seconds++;
        const mins = Math.floor(seconds / 60).toString().padStart(2, '0');
        const secs = (seconds % 60).toString().padStart(2, '0');
        timerBox.textContent = `Time on X: ${mins}:${secs}`;
    }, 1000);
})();