How does one build something like Clicky, which tracks users' movements, where they came from, etc? I want to learn more about my customers and I also want to learn more about web technologies and analytics, so I figured building Clicky-like features on my own would be a good place to start. The problem is, I'm not sure where to start. What sorts of things should I be learning more about (cookies, sessions, etc)?
Best Answer ncc50446 , 20 March 2014 - 22:02
It's a lot of work to build your own. I build my own, and it took a lot of work, and I'm still working on it lol I decided to make my own as something to learn more PHP.
You basically need to get their user agent, referer, current page, time/date, and location (I use GeoIP).
Then you need to decide if you're going to use flat files, or a database (I use a database, hate flat files lol).
Then you need to go through thousands of user agents to make a script to find out what browser/os they are using.
So if someone visits with a user agent of:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.11 Safari/537.36 OPR/21.0.1432.5 (Edition Developer)
You need your script to find out they are using Windows 7, and Opera 21.0.1432.5
There are thousands of user agents (You can thank bots for that..far too many bots..).
Then you need to compare dates, and the page they are on, and their previous page, to calculate how long they spent on the page.
Unless you have a bunch of time, it's just easier of using Google Analytics, BBclone, Piwik or Clicky lol No use re-invinting the wheel if you don't have to. Though I did enjoy building my own.Go to the full post