rather than upgrade google analytics to a new major version—why not instead write my own analytics library on a sunday afternoon
why not
60 replies
@zachleat If you don't end up finishing it, I've been using Plausible and it's been lovely.
@joshwayne ah, looks like that might cost me $50/month 😭 too much for my personal web site
@zachleat there's a self hosted version https://github.com/plausible/analytics
@joshwayne ah nice! The WordPress model of OSS
@zachleat Sounds easier than dealing with the UI of the new google analytics.
@zachleat Just installed Matomo -- meets all the needs of all my clients and everyone I ever worked with. People fantasize about getting their Analytics going hard-core, but I have not seen a successful and complex use-case; only simple ones.
@jamienk I have no ambitions beyond a simple counter for pageviews 🤷🏻
@shaunrashid @jamienk not sure if I will open source this one yet—gonna let it run and see how far it can get on this database free tier first
@zachleat https://matomo.org/faq/on-premise/installing-matomo/
Took a few min to set up - I'm using LAMP anyway so this was a good for for me.Now that I know how it works I can use it for future projects. It has an API so I can create my own interface to show clients their stats.
@zachleat Or just go for Plausible and be done with it. Unless you're a geek, of course, in which case of COURSE you're gonna write your own library because that is what geeks do.
@nullsprite OF COURSE 😅
@zachleat I mean, why not just ditch it. Who needs to know how many visitors you have anyway. Just guess from server side requests and write for yourself, not your stats
@steveworkman normally I’d agree but I am trying to keep this section of my web site accurate: https://www.zachleat.com/web/best-of/
@zachleat GA4 is only 146GB of js remote loaded from a server using all of a small towns water supply to cool it, what’s the big deal?
@knaackbuilt does it AI though
@zachleat ::slaps hood of ga4:: you can fit an entire antitrust lawsuits worth of AI in here! #insertmeme
@zachleat if you’ve got a place to run a container, this ain’t bad https://github.com/umami-software/umami but sometimes you just need to do that
@zachleat Eleventy 3.0?? 😂
@peruvianidol you ever take a break from writing code to write other code
me either, no, that would be silly
@zachleat My trick is to not start writing code in the first place.
@zachleat will you OSS it?
@cferdinandi I want to see how far it goes on this database’s free tier before I release anything
@zachleat Out of curiosity, it is JS-based or are you using server-based approaches?
@cferdinandi just one https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon call which is blocked by ad-blockers, fairly enough. In my experience server-based stuff over-estimates because it includes bot-traffic
@zachleat Another person already mentioned this but I just have to second it... https://github.com/umami-software/umami is really great. You can see how I used the API on my website here: https://github.com/uncenter/uncenter.dev/blob/main/utils/umami.js
@zachleat Those functions I linked to from my website above are used here:
https://github.com/uncenter/uncenter.dev/blob/main/src/posts/posts.11tydata.js#L20-L25@uncenter that pricing is decent!
@zachleat eleventy-plugin-stats
@djwebdroid now we’re talking
@zachleat Maybe take a look also at https://www.goatcounter.com/
@romanvesely yeah, this is one that I seriously considered! I was leery of yet another third party script that didn’t use subresource integrity
@zachleat Let me quickly summarize why I think that's a bad idea
(1/132)
@erikKroes erik I think your thread got cut off
@zachleat omg twitter engineers must've taken over
@erikKroes defederate defederate defederate defederate defederate defederate defederate defederate defederate defederate defederate defederate
@zachleat you knew https://www.awstats.org/ still exists?
@murb for sure! that’s OG, I remember using it years and years ago
@zachleat I had to work with Google Analytics 4 at work. It's much easier to write it for your own needs completely from scratch.
@kaiserkiwi my sincerest condolences 💐
Well, it’s working. Can it survive a month on FaunaDB’s free tier? Only time will tell 👀
@zachleat Elizabeacon - I like it haha. Would be even cooler if beacon sent HEAD requests!
Other options you could have gone with:
Mmm...beacon
Sir Francis Beacon (his famous motto; "bene visit qui bene latuit - one lives best by the hidden life" seams to make some sense for analytics)
@scrwd oh my god sir francis beacon, can I use that instead
Update: looks like my traffic spiked a bit and FaunaDB disabled my account and deleted my data from this project 😅
Glad I didn’t share this approach—I guess extortion is one way to upsell from the free tier :eyeroll:
Saved the analytics data out of the @11ty/eleventy-fetch cache on my build server, so *pffft* 😛
-
-
-
@cthos found this, in retrospect 👼
@zachleat nuking your data and disallowing access to it is a bit...extreme? They _could_ have just disabled read/write access (or just write access, if they want to be polite).
That's a ... bold ... strategy
@cthos they were very polite 😬
@cthos @zachleat afaik they don't have backups readily available either (in the UI, free plan) - had to roll my own when I realized.
I used to be quite fond of their service, never ran into issues, even with multi-user production apps. I guess enshittification continues, and that we're all better off going back to mySql on our own boxes for things that matter 😢
@zachleat Interested to know what might be your replacement solution! Please let us know! :)