this post was submitted on 10 Oct 2023
25 points (100.0% liked)

Selfhosted

40173 readers
919 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Google Analytics is broken on a bunch of my sites thanks to the GA4 migration. Since I have to update everything anyways, I'm looking at the possibility of replacing Google Analytics with something I self-host that's more privacy-focused.

I've tried Plausible, Umami and Swetrix (the latter of which I like the most). They're all very lightweight and most are pretty efficient due to their use of a column-oriented database (Clickhouse) for storing the analytics data - makes way more sense than a row-oriented database like MySQL for this use case.

However, these systems are all cookie-less. This is usually fine, however one of my sites is commonly used in schools on their computers. Cookieless analytics works by tracking sessions based on IP address and user-agent, so in places like schools with one external IP and the same browser on every computer, it just looks like one user in the analytics. I'd like to know the actual number of users.

I'm looking for a similarly lightweight analytics system that does use cookies (first-party cookies only) to handle this particular use case. Does anyone know of one?

Thanks!

Edit: it doesn't have to actually be a cookie - just being able to explicitly specify a session ID instead of inferring one based on IP and user-agent would suffice.

all 14 comments
sorted by: hot top controversial new old
[–] kglitch@kglitch.social 6 points 1 year ago (1 children)
[–] dan@upvote.au 2 points 1 year ago

I'm considering Matomo, but its tracking script is huge and can't easily be bundled with my site's code (whereas systems like Plausible have their tracking scripts available on npm). Looking for something a big lighter on the JS.

[–] smpl@discuss.tchncs.de 3 points 1 year ago (1 children)

If you still want to respect user privacy, your analytics software could use the port of the connection instead of IP as the identifier. It would be perfectly fine for determining simultaneus users from the same IP, but not invasive enough to monitor an individuals behaviour. Don't ask me which analytics software supports that. I'd grab the data from the http logs if it was me and use a tool like goaccess.

[–] dan@upvote.au 2 points 1 year ago

Each request to the site may use a different port though (if the keepalive times out).

I'd grab the data from the http logs if it was me and use a tool like goaccess.

Unfortunately this has the same issue with multiple people sharing an IP appearing to be one user.

Another major use case I thought of are people stuck on CGNAT. It's easily possible for tens of thousands of customers to share just dozens of public IP addresses. Unfortunately some providers are rolling out CGNAT instead of IPv6 even though it causes so many problems.

[–] johnnyfive@lemmy.world 2 points 1 year ago* (last edited 1 year ago) (1 children)

In Plausible you can use custom events: https://plausible.io/docs/custom-props/introduction

I think this should be enough

[–] dan@upvote.au 1 points 1 year ago* (last edited 1 year ago) (1 children)

I don't think this would fully help? It'd still show that one user performed all the events.

I just need a way of explicitly specifying a user identifier instead of it being assumed based on IP and user agent. I don't think Plausible has a way to do that. I was chatting with the developer of Swetrix and they said it might be possible to add this as a feature.

[–] johnnyfive@lemmy.world 1 points 1 year ago

you can generate a new cookie with the value you want to identify that computer and use/capture that same value in the plausible custom event

[–] Decronym@lemmy.decronym.xyz 1 points 1 year ago* (last edited 1 year ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
CGNAT Carrier-Grade NAT
IP Internet Protocol
NAT Network Address Translation

2 acronyms in this thread; the most compressed thread commented on today has 11 acronyms.

[Thread #207 for this sub, first seen 11th Oct 2023, 06:15] [FAQ] [Full list] [Contact] [Source code]

[–] eluvatar@programming.dev 1 points 1 year ago

It's not plug and play, but Open telemetry is the self hosted way to go.

[–] shrippen@feddit.de 1 points 1 year ago (1 children)
[–] dan@upvote.au 1 points 1 year ago* (last edited 1 year ago)

Umami is one I'm considering. I don't think it allows a session ID to be provided though.

It also uses a row-based database (like MySQL or PostgreSQL) rather than a column-based database (like Clickhouse), which for analytics data is way less efficient and significantly slower once you have a lot of data. Pretty much all queries you'd want to run load a lot of data by column rather than row (eg charts of most common browsers, countries, etc over the past 6 months) so they benefit greatly from a columnar database.

[–] nutbutter@discuss.tchncs.de 1 points 1 year ago

Have you looked at all of these from the Awesome-Selfhosted list?

[–] ioslife@lemmy.sdf.org 0 points 1 year ago

TelemetryDeck!