Jump to content

track audio plays wordpress


Recommended Posts



I have been looking for a way to track the play stats on audio mp3's in the admin of my custom post-type. Whatever I google seems to come up with nothing. I not very versed in audio player code - could someone please point me in the right direction. 



I have a custom post-type which uses the wordpress default audio. 

I would like to get the number of plays for each audio file and display that in the admin column for my custom post-type




Link to comment
Share on other sites

  • 2 weeks later...

If you're willing to code this yourself, you could write a plugin that detects the play button being clicked. This part would most definately be javascript. You could then use ajax to send this click to a php script which updates the count. I'm not well versed in created wordpress plugins but it sounds like a good project.

Link to comment
Share on other sites

"How" are the files being accessed through the player? Are the files being accessed directly such as mysite.com/mp3s/somefile.mp3, or are they being accessed through an intermediary page such as mysite.com/playmp3.php?id=22? If it is the latter then you can just add code to the page that fetches the mp3 to also update metrics around those requests. E.g. how many requests, when, by who, etc. Basically you can track anything that you want to track as long as you have that data. I.e. you can track who is playing certain files if you have a login system (or you could at least track by IP, although it is a poor approximation of an individual).


If the files are not being accessed through an intermediary page, you have some options:


1. You can create an intermediary page and use that instead of allowing them to access the files directly. This is a good idea anyway.


2. You could implement AJAX. But, this seems like a lot of complexity for what you are wanting to accomplish


3. There are server-side logs. Depending on how (and with whom) you are hosting your site, your level of access to those logs may differ. My host gives me access to my logs through a web interface for manual inspection. but, I also have direct read access to the files. So, I could build my own code to parse that data if I wanted. Although this would likely only include IP address and files accessed.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.