how bad of an idea is it to write to a pageViews column in the db on every pageload lmao?
how bad of an idea is it to write to a pageViews column in the db on every pageload lmao? I'd rather not pay for a 3rd party analytics tool while at a small size
11 Replies
I've been curious of a good way to handle this as well.
yeah a lot of the pricing on the 3rd party tools doesn't scale well at all
and idk how well they play with adblockers
I freelanced for a startup that took this approach via a micro service, basically on initial page load we'd call a micro-service and pass along the current user, which then offloads the handling of writing to a mongodb atlas instance and sending the data off to a 3rd part analytics tool.
I didn't really notice any issue with the approach in nextjs
not a bad idea actually
haha look at the timing of this
Vercel acquires Splitbee to expand first-party analytics – Vercel
Introducing the next generation of Vercel Analytics
wont be free, im sure, but this might be a good option in the very near future
Im sure something similar could be done with an edge function or if u use postgres a remote procedure call might also be feasible.
could even simplify it down to a trpc call that writes to the db, I don't think you'd have to wait for a response unless im forgetting
yea no reason to wait for the response at all.
as long as ure handling errors that could def. work.
interetingly, this was just discussed on nextconf right now: https://partytown.builder.io/nextjs
I keep forgetting about partytown..
fyi its still in beta, but it seems very promising