ListenBrainz keeps track of music you listen to and provides you with insights into your listening habits.
We're completely open-source and publish our data as open data.
If you use Last.FM, you can import the data into your listenbrainz account. Listenbrainz also has Spotify integration.