dgp1130 / blog

Source repository for my personal blog.
https://blog.dwac.dev
3 stars 2 forks source link

Track scroll depth of posts #34

Closed dgp1130 closed 2 years ago

dgp1130 commented 2 years ago

It would be awesome to have some (anonimized) metrics around how far users scroll in blog posts. This would help give a sense of how much of a post users are actually reading, if they're falling off somewhere, or if it's too long.

Custom events could maybe do this, but I don't see a good way of aggregating them in a useful fashion: https://plausible.io/docs/custom-event-goals.

Otherwise I might need to wait for better support in Plausible: https://github.com/plausible/analytics/discussions/121 https://github.com/plausible/analytics/discussions/810

dgp1130 commented 2 years ago

https://github.com/plausible/analytics/discussions/121#discussioncomment-2198451 shows that this can be done by bucketing users into scroll depths of 10% increments. I initially thought that wasn't good enough unless the backend filtered to just the maximum scroll depth for a particular user / session (since everyone who scrolls 40% also scrolled 30%, 20%, etc.). In retrospect you can compare the difference in adjacent buckets to know how many users scrolled to a particular 10% range. That's probably good enough, though it would be nice if the UI could better visualize it.

dgp1130 commented 2 years ago

Landed https://github.com/dgp1130/blog/commit/4659e35baed0bd6caf12a942cba490314f37fbd5 and https://github.com/dgp1130/blog/commit/53f782686a3446897e05bbd4384e9f156c4b2f60 with the core implementation. This technically works, but isn't very usable in the Plausible UI IMHO. I brought this up in the discussion on their repo, but I think this is the best I can do for now.

It's good enough for a blog of this size, but definitely something I'll want to revisit eventually. Hopefully by then there will be better support for what I want to do.