Ethan Gayton
← All projects

Listening Stats

A self-updating YouTube Music history and a dashboard that tracks skips and listening time more accurately than most play-tracking tools.

20 min
between syncs
0
duplicate plays after re-imports
11
dashboard panels
1 file
self-contained report, no server needed

Why I built it

YouTube Music doesn’t show you any listening stats. The usual play-tracking tools miss plays, and they can’t tell a song I finished from one I skipped five seconds in. I wanted a complete history that I own, plus a dashboard that shows what I listen to, when I listen, and which old favorites I’ve stopped playing.

How it works

I import my full history from Google Takeout once. After that, a scheduled job checks my recent history every 20 minutes and figures out what’s new. The hard part is that YouTube Music removes duplicates from that list, so a song I replay jumps to the top and disappears from its old spot. The sync has to line the new list up with the last one while allowing for those moves.

Every play is stored once, keyed on the track and the time. Synced plays only have estimated times, so when a newer Takeout export comes in, its exact rows replace the estimates for that period. Importing again never double counts.

Deciding what counts

Before I could measure listening time, I had to decide what counts as a play and what counts as a skip. I wrote those rules down first:

  • A song counts as skipped if the next one starts before it’s halfway through (and within four minutes).
  • Listening time is the song length or the gap to the next song, whichever is shorter.
  • A session ends after 30 minutes of silence.

Every chart on the dashboard follows those rules.

Making sure it’s right

Each awkward case has its own test: nothing new, new songs on top, a replayed song jumping up, the whole list changing, a first run, and a Takeout import replacing synced plays. The stats tests use tiny hand-built histories where I already know how many skips and sessions there should be.

Try it

About 13,000 plays over 18 months by made-up artists, run through the project’s real stats code and dashboard. Filter by year, or choose whether skips count.

Listening dashboard sample dataOpen full screen ↗