DEV Community

ihucos
ihucos

Posted on

Web Analytics for pet projects

Some time ago I just used Google Analytics for my pet projects. But now with the DSGVO I don't know exactly how that is supposed to work. After some reading about that I came to the following conclusion: We need some quick and dirty way to just have basic tracking of users in web projects.

So here it is, a Cookieless, Free (not Freemium) service to track users. There is no user id assigned to traffic and I don't save IP addresses. Does this make it "DSGVO-Compliant"? I honestly don't know, but think it's pretty cool: https://simple-web-analytics.com/

The server is written in Go, there's some vanilla JavaScript and Bootstrap on the frontend, also Chart.js. And the database is redis. On my Cheap 5 Dollar Linode VPS it can handle ~ 2000 requests per second to track users. There is geolocation, referrer and top pages tracking and everything you would expect. HTTP Caching is used to ensure every user only (mostly) hits the server once per day per site being tracked.

Check it out :-)

Top comments (9)

Collapse
 
tovare profile image
tovare

Google analytics without cookies

Hi, you can disable cookie-tracking in Google Analytics, you can find docs on how here: developers.google.com/analytics/de...

If you need to tie multiple pages/user-events together generate a random session ID and keep it in session storage or for a SPA in a global javascript-variable it will be kept in memory and deleted when they leave your domain, as such no tracking is stored on the user's computer (it is a lot more restrictive since it is the same origin only).

Also, remember to anonymized IP addresses and filter out any URL-variance which might be a privacy risk, in addition, select the EU-version of GA and don´t turn on data-sharing (The user interface will warn you that you need consent to activate certain features such as demographics and re-marketing). In addition, there is an App+Web analytics property that will let you treat data more like a stream of but with features that will help with measuring both web and app-versions.

Collapse
 
ihucos profile image
ihucos

Yeah, I read that and for me personally that is kind of too fiddly. So by disabling cookies with Google Analytics I still need a way to persis user ids (localStorage is mentioned)? That is how I understand the link posted. From my understanding (what I heard somewhere) the DSGVO it's not so much about cookies but user id based tracking in general.

Collapse
 
tovare profile image
tovare

Yes any form of fingerprinting. Including anything stored on a user, the computer is considered personal information including and perhaps especially creating a user ID that you use to connect with other data without consent.

I agree, It is very fiddly to get right because you need particular care if other collected data could become a privacy risk (Such as hello <> in the page title). But I also feel that it is critical to monitor services at the user-interface level in production, so it is worth the trouble to get right.

I understand anonymous session tracking for the purpose of maintaining a site to be within the law if properly handled, but not well tested in the courts. Article 24 of Regulation (EU) 2018/1724 requires member states to have web statistics on some public services.

Collapse
 
tovare profile image
tovare

Itś is great that you provide options for basic scenarios :-)

I remember back in the day where I used a site counter and I have thought a few times, it would have been cool if those services existed still. Now (compared to 1997) there are even more instances where you don´t have access to the logs (and bots are a huge chunk of traffic for a small site, so running some javascript eliminates a lot of the ones who don´t identify themselves properly like Googlebot)

Do you have plans for the ability to show the traffic as well?

Collapse
 
ihucos profile image
ihucos • Edited

Do you have plans for the ability to show the traffic as well?

You mean to show all http traffic comming in instead of counting visitors? Actually not, because then I'd need to charge money for the service. At least I imagine that it can get quite a lot of traffic to handle if there is some popular website using Simple Web Analytics. Yeah, so to count really all requests coming in, I'd try to rely on logs.

Collapse
 
tovare profile image
tovare

I thought like in the olden days of a snippet you could have on a page showing the number of visitors you have had. It would probably be way too cheesy in 2020, but a nice nod to history from 20 years ago :-)

Thread Thread
 
ihucos profile image
ihucos

There seems to already exist free services that offer this, you can choose from multiple designs and customize colors. freecounterstat.com/ is one of them. With Simple Web Analytics I'll try to focus more on essential insights for web page owners. But the kind of "oldschool" webpage design on simple-web-analytics.com/ is on purpose, so I am glad it seems to call that associations.

Collapse
 
tovare profile image
tovare

If all you need is some metric, there are alternatives:

A few months ago I used stathat.com/ , to keep track of a few metrics and it has worked like a charm (the free version).

You could also look into Stackdriver to show some metrics. I haven´t really tried this out much but I was a bit inspired by the Google+Apple COVID reference server which had the uber zap logger with a few fields for Stackdriver.

Collapse
 
ihucos profile image
ihucos

stathat.com looks nice, 10 counters for free sounds reasonable. But $99/month for unlimited counters seems very steep. It's kind of a very general purpose thing, so you don't have referrer tracking, not counting in bots and stuff like that. I'd definitely use it for tracking more "technical" things.