Eleven years of Spotify, all at once
How I turned Spotify's extended streaming history into a dashboard: a one-off extract, aggregates instead of raw plays, genres tagged by hand, and the cleaning that changed the numbers.
- Data engineering
- Data visualisation
Every December Spotify Wrapped tells me who my top artist was that year. Then it starts over. I wanted the version that doesn't reset: everything since my first play in June 2015, on one page. The Spotify dashboard is the second entry in the Lab, after chess, and I built it the same way: extract, model, visualise. This post covers the decisions, including a few where the raw data was wrong.
Extract: a file you ask for
There is no Spotify API for your full listening history. What exists is the "extended streaming history" export: you request it from your account's privacy page and, some days later, get a zip of JSON files. Mine held 106,631 rows, one per play, from June 2015 to October 2026.
Each row has a UTC timestamp, how many milliseconds were played, the track, artist and album (or podcast show and episode), why the play started and ended, whether shuffle was on, whether it was offline, the device, a connection country and an IP address.
Because the export is a one-off file, the extract is a script I run by hand rather than a build step. It reads the unzipped folder from wherever it lives on disk, and only its output goes into the repository.
Model: aggregates this time, on purpose
For the chess dashboard I ended up storing one row per game, because I wanted to drill into anything. Here I went the other way. A row per play would be about 100,000 rows with timestamps, which is both heavy and far more personal than a public page needs. You could rebuild any given day from it.
So the script writes totals at a few grains, each chosen for a chart:
- month × artist: minutes and plays, for the timeline and the artist filter.
- year × artist: plays, and plays on shuffle.
- year × song: plays, for songs with at least 20 plays.
- year × artist × weekday × hour: minutes, for the "when I listen" heatmap.
The top 1,000 artists keep their names; the other 4,600 or so are summed as "everyone else". The page folds the bulky weekday-by-hour table further at build time, so the browser gets a grid per year and genre and one per top artist, not the whole cube.
Dropped completely: IP addresses, timestamps, device names, and every play made in a private session.
The cleaning that changed the numbers
Zero-second plays aren't plays. About 2,500 rows have ms_played of 0. My first count said my most
played song had 598 plays. Without the zero-length rows, and with all versions merged, it has 361. Still
the top, but no longer a ridiculous outlier.
The same song is several songs. "Hallowed Be Thy Name" and "Hallowed Be Thy Name - 2015 Remaster" are different tracks to Spotify, with different IDs. Grouping by title and artist, with remaster suffixes stripped, puts them back together.
Country is the network, not the place. Every row has a conn_country, so a travel map looked free. But
it comes from the connection. Mine shows the Netherlands for months at a time in 2025 and 2026, and
Switzerland, where I live now, for barely 21 hours. That says more about how my phone's network routes
traffic than about where I was. I replaced it with
a small config file of where I actually lived and when: Brazil, then Italy from July 2023, then Switzerland
from April 2026. That file also sets the time zone for each play, so a Brazilian evening isn't counted as a
European night.
Genre isn't in the data. Spotify's export has no genre field. I tagged my 1,000 most-played artists by hand, one broad genre each, in a plain list that's easy to correct. That covers about 91% of my listening time, and the rest shows honestly as "untagged" rather than as a guess.
Some titles stay out. A few songs I play have titles that mention suicide. Out of context on a public page they read very differently from how they sound, so the script redacts those titles, with a short list of exceptions I'm happy to show. A separate list keeps a few artists off the page entirely.
Interact: the chess pattern again
The page reuses the chess dashboard's pieces: a sticky filter bar, clickable sentences at the top, and cross-filtering where each panel applies every filter except its own. Filters are year, genre and artist. Click a month on the timeline and everything focuses on that year; click an artist and the page turns into their card, with when I first played them and when I play them during the week.
The new piece is the genre-by-year grid: one column per year, one row per genre, darker for a bigger share. The obvious alternative, a stacked area chart, would need fourteen colours to tell the genres apart, and nobody can read fourteen colours. One blue on a scale they can.
Two charts Wrapped can't make
Wrapped only ever looks at one year, so two questions are out of its reach.
Phases or constants? Each dot on the scatter is an artist with at least 15 hours. Across is the number of years I played them for an hour or more; up is the share of all my time with them that fell in their single biggest year. Top left are phases: 83% of my 41 hours of Mc Davi happened in 2022. Bottom right are the constants, with Iron Maiden, Red Hot Chili Peppers and Slipknot spread over ten years or more. In any one Wrapped, a phase and a constant look exactly the same.
Did moving change my music? The second chart puts each genre's share of my music side by side for every place I lived, using the same date config as the time zones. It's the clearest result on the page. Heavy metal was 17% of my listening in Brazil and is 7% since I left. Sertanejo went the other way, from 3% to 9%. Apparently the music from home gets more attractive the further away home is. Switzerland only has a few months of data so far, so its dots will move.
What the data says
Some findings, from about 4,300 hours of listening:
- Iron Maiden is my top artist overall (197 hours) and in my top five in 8 of the 10 full years.
- About 31% of the music is metal of some kind. Brazilian genres together are 27%.
- My most-played song, Hallowed Be Thy Name, has 361 plays, 233 of them in 2022 and 2023.
- 60% of my plays were on shuffle in 2018. Since 2020 it has stayed under 15%.
- 2020 was my most curious year, with 943 artists I'd never played before.
- My busiest hour is 17:00, and Saturday beats an average day by more than a quarter.
Tools
Next.js and TypeScript, with the extract as a Node script and deploys on Vercel. The charts are hand-written SVG and CSS, shared with the chess dashboard. It's free to run and has no database.