Get average hits (day, week, month) with SQL/PHP
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.
+----------------+----------------+----------------+----------------+ | start | end | unique_id | id | +----------------+----------------+----------------+----------------+ | 1358789867 | 1358789872 | (hash here) | 65 | +----------------+----------------+----------------+----------------+ | 1358789966 | 1358789972 | (hash here) | 66 | +----------------+----------------+----------------+----------------+ | 1358789998 | 1358790003 | (hash here) | 67 | +----------------+----------------+----------------+----------------+
Cheers.
Join 15,000+ other Android fans on my Facebook @ Droids R Us
Also join me at Texo digital