Comment

Comment by ukutaht

Nice post, Bradley. I think you might be the first one doing A/B testing with Plausible :)

Just a heads up, I think registering a plausible event in the `onclick` handler could introduce a race condition. If the page navigates and unloads before the request to Plausible is sent, you might miss the click in analytics.

The code here is a bit obtuse, but for our Outbound Link tracking feature we set a 150ms delay for navigation [1]. It should give enough time to complete the request to Plausible.

I am planning to tackle this limitation by seeing if we can implement custom event tracking with `navigator.sendBeacon` instead.

1. https://github.com/plausible/analytics/blob/master/tracker/s...

parent ukutaht 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton