![]() |
Get average hits (day, week, month) with SQL/PHP Hey all Does anybody know how to work out average hits per day, week and month based on UNIX timestamps? Basically I want to track users time on my site and average hits for analytics (I know I can do this in Google Analytics, but I've built some blogging software for personal use and want some basic analytics). I've already worked out how to calculate average time on my site with my data. I have a table in MySQL with the following format: Note "start" and "end" are UNIX timestamps. Code: +----------------+----------------+----------------+----------------+Cheers. |
Re: Get average hits (day, week, month) with SQL/PHP Are you going to log the amount of visitors in a time range or will it be the individual time for every visitor. Your first row in your example is a 5 minute period so are you counting x visitors per 5 minute period. |
Re: Get average hits (day, week, month) with SQL/PHP I'm logging the UNIX timestamp for when they land on any page on my site, and logging the UNIX timestamp for when they leave (close the browser or navigate away, updated via AJAX), so I'm not using any time frames, simply the length of time each individual is on my site. To calculate the hits I know I can just use the "start" time, but I don't know how to extract the data I want or which functions could help. Your post is appreciated! Thank you. |
Re: Get average hits (day, week, month) with SQL/PHP Quote:
To work out averages you can 1) take the start date / end date convert time to a time stamp with strtotime() 2) grab all the entries with a start time within that range 3) count the entries |
Re: Get average hits (day, week, month) with SQL/PHP Quote:
|
| All times are GMT -6. The time now is 03:29 AM. |