January 6, 201412 yr Hey all, I was just wondering how website analytics tools are made? Google analytics, squarespace analytics etc. I was wondering if it can be done in php/javascript or if other languages are used. Id like to have a go writing my own purely for fun just to learn but not 100% sure where to start.
January 6, 201412 yr The basic data is mostly captured via javascript, the data being values that can be captured from a web browser eg, Date/time User agent Page URI Referring page IP address ...and so on Once the data is captured it's send to a central database, then from there the database can be quiried to produce reports.
January 6, 201412 yr I was going to say it's basically a very extensive JavaScript library that connects to a back end API, that could be written in PHP I suppose, to store data in a complex database - or rather, data warehouse in the case of Google. Edited January 6, 201412 yr by andy9l
January 7, 201412 yr Those above have got it bang-on. The only other thing to note is that they will usually set a cookie in the user's browser, which is what can help when determining new vs returning visits and such. The approach you take in writing a custom system all depends on what data you're wanting to capture. A very basic system could be easily embedded into each page with PHP, just to pull the browser versions, IP and such. Throw this data into a MySQL database and then find a way of presenting it, and you're done. It's worth remembering though, that the data any scripts like this can collect are easily falsified by the end user. This once again feeds back into your design, as you need to ensure that data you gather is useful and you understand the context fully. As with all projects - begin by identifying what data you want to collect, how it should be processed, and what the output should be. Jon
January 10, 201412 yr Author Thanks for the great response guys! I feel like it is actually something that I could build. I like to have fun weekend programming projects so this seems like a great one to get stuck into as I can use Javascript and PHP, perhaps even transition it to node.js after
January 10, 201412 yr It's definitely possible to build something simple – and a good learning experience. Good luck
Create an account or sign in to comment