From Listenbrainz website:
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.
Oh yeah, can’t forget the web scribbler even if it does get a bunch of false positives sometimes from YouTube
I only stream music from YouTube music and scrobbling is disabled for YouTube