How Bear does analytics with CSS

Bear Blog has specific design constraints in place for speed, efficiency, and stability. While there are many great analytics platforms available, the author wanted to create one that is native to Bear. One key constraint is the avoidance of client-side javascript, as it can be manipulated to determine the authenticity of traffic, particularly for bots. The drawback is that adblockers often block analytics scripts, including popular ones like Google Analytics. Instead of relying solely on server logs, the author triggers a read with CSS. By using CSS to call a URL for each page hit, the author can differentiate between human readers and bots. Identifying information about the reader is not stored in browser cookies or on the server. Instead, the IP address is used to determine the country, and it is hashed along with the date to create a unique “read” of a page. The IP address hashes are scrubbed from the hit logs at the end of each day. Overall, this method of analytics capture provides a concise and simple way to track reads accurately.

https://herman.bearblog.dev/how-bear-does-analytics-with-css/

To top