samoht Posted September 1, 2014 Share Posted September 1, 2014 Hello, 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. Again: 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 Thanks, Drew Quote Link to comment https://forums.phpfreaks.com/topic/290778-track-audio-plays-wordpress/ Share on other sites More sharing options...
samoht Posted September 16, 2014 Author Share Posted September 16, 2014 OK, so maybe this would need to be an AJAX operation or onClick event of some sort??? I'm not really sure though because I want to store the data retrieved?? Any ideas? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/290778-track-audio-plays-wordpress/#findComment-1491225 Share on other sites More sharing options...
GnRDenver Posted September 17, 2014 Share Posted September 17, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/290778-track-audio-plays-wordpress/#findComment-1491365 Share on other sites More sharing options...
Psycho Posted September 17, 2014 Share Posted September 17, 2014 "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. Quote Link to comment https://forums.phpfreaks.com/topic/290778-track-audio-plays-wordpress/#findComment-1491400 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.