What you will practice
Building your own simple web analytics tool is an excellent way to understand how common web analytics services work - and how marketers track your activity online.
Introduction
You’ll build a simplified web analytics tool with the ability to track views, timestamps, anonymized user agents, and the referrer, and to display this data.
Requirements
- Use a tracking pixel to save relevant data about each view.
- Display the aggregated data in table format.
For an extra challenge: Display your aggregated data using JavaScript charts.
Suggested Implementation
Most analytics services are based around a “tracking pixel” - a tiny 1px transparent image, often accompanied by tracking code, which is embedded on the page being tracked and used to record data about each pageview. The tracking pixel makes a loggable request to the analytics server, which allows the server to store information about the request.
The request logs are typically parsed to extract information about the pageview, and saved in a format that can later be used for reporting. A 1px transparent .gif image is used by convention because this is a lightweight way to initiate a request to the analytics server without noticeably degrading website loading times or UX.
Typically, tracking pixels are designed to store as much information as possible about the request, and often, the user behind the request. This raises privacy concerns when pixels track and store personally identifiable information (PII) like IP addresses and search queries, or associate activity on a website with a user. By storing only essential data, you can build a minimalist analytics app that is simpler and more privacy conscious.