I have JWplayer installed on my website and would like to record and store the number of views my videos get.
I already have all the javascript and ajax code needed to store data into my database after someone hits play. However I feel that incrementing a number in the database every single time someone plays a video is inefficient.
What would be the best most efficient method to solve this problem?
Thanks.
I asked a similar question several months ago, but it related to ads. I wanted to know the best way to track ad renders so I could bill clients accurately. The response I got was to use access logs. So I ended up writing a parser to extrapolate out all the ads from a server log and import into a table for report viewing.
Something to look out for if you are going to use access logs as the source for tracking this type of information. Logrotate, make sure you are pulling the data out before logrotate overwrites a logfile. I’m not really a systems guy, but I set my logrotate up so that every day at midnight the days log file gets moved to a new location.
Another benefit of access logs is if a client (or anyone) questions your numbers you can refer back to the source log file and demonstrate that your numbers are not inflated.
— Edit —
Example of access log entry: