Hello #faircamp folk. I'm wondering if anyone is doing anything to track plays on their faircamp site?
I've got a #matomo tag on my site but I don't fully know what I'm doing.
I guess there are different ways to approach this (server logs?) so just wondering if there is any knowledge out there to share.
Thinking a recipe or guide for people setting up their sites might be a nice thing.

If anyone is following this....

I've got a proof of concept running using a self-hosted (well, work hosted) #matamo instance.

In the static site generated faircamp html I've added some data-content-* tags to the elements around the play button on the track and I can see that matamo picks up that the 'tracks have been shown to a site viewer' and registers a click on the play button (it also registers a click on the pause button tho!)

@txels

so this is relatively simple - I don't need to do any javascripting - just type a few words in the right places BUT to make it useful I could...

...just about get away with a find and replace script on the static files (I think!), BUT think I might really want to hack the #faircamp code so that it also e.g scripts the track name into the matomo data it sends.

I'll persist and blog about it if it works.

Oh - I should say Matomo does have a paid Media Tracking plugin to do this!

@txels

Not as easy as I'd hoped, but I'll share my learning in a blog post soon.

I use a docker image from @n3wjack to build, so ended up cloning the #faircamp code, making 3 or 4 tiny edits, then sort of decided I needed to build my own docker image. Some wrangling later and it seems to be 'working'.

I'll write it up....

@txels

Writen up my adventure so far in tracking plays from my #faircamp site.

https://theargentgrub.co.uk/2026/06/10/tracking-plays

Spoiler alert, it's not amazing, but it might be the start (or the end!) of a conversation.

Thanks to @n3wjack @txels @freebliss for all the work they're doing.

Tracking Plays

How to tell how many plays songs are getting when you self host?

The Argent Grub

@theargentgrub nice! Something that just came to mind is that (if you're using a custom build anyway) you could somehow hook into javascript.

For instance, this function is where every play has to go through: https://codeberg.org/simonrepp/faircamp/src/tag/1.7.0/src/assets/player.js#L270 (applies both to plays that are triggered by the listener, and plays that come from playback automatically advancing)

The track object passed to that function should also contain a reference to the metadata you need for "prettier tracking" (title, track number, etc.), just do a console.log(track) on it to inspect it.

Then, either you could communicate with matomo through some js interface (if exists and feasible), or you could add (a) hidden button(s) to the generated markup that you track with matomo's data-* attributes, and on which you trigger synthetic click events through a javascript hook in the play function (a bit wild, but who knows, might just work :D).

faircamp/src/assets/player.js at 1.7.0

faircamp - A static site generator for audio producers

Codeberg.org

@freebliss thanks so much for taking the time to look, engage and offer suggestions. I'll dig into what you say but it will take me sometime before I can give it my proper attention. Really useful for you to help shine a light on where to look.

Thanks again

@theargentgrub sure, you're welcome! and no hurry at all, 2.0 is keeping me busy anyhow :D
@freebliss yeah I can see - well done. Keep up the good work!

@theargentgrub
@txels @freebliss
As you mentioned at the end, I'm thinking the server logs will also work to give you an impression of plays.
The Faircamp player will start a download of the mp3 file when the play button is clicked, and that will be visible in your server logs.
With a free tool like AWStats it's pretty easy to generate HTML reports from those logs.

Some hosters have this built in, but it's not that hard to DIY.

The plus side is that you don't have to do any client side tracking/Matom setup, or use a custom version of Faircamp.

@theargentgrub @txels @freebliss

@n3wjack @txels @freebliss Yes - after wrangling with all the stuff that I thought would be quite easy - not wrangling any of those things would be good!

I did a bit of research into server log approaches, and some self-crafted analytics solution, so I'm sure I'll tinker with some things in the coming weeks.

I'm wondering what other #faircamp users are using and if maybe there are some recipes that could be shared for different skill levels.

@theargentgrub
@txels @freebliss

If you happen to be on Windows, Logparser from Microsoft is a handy tool for ad-hoc queries on www log files.
You can use SQL-like queries on a bunch of files, and it's surprisingly fast.