(no title)
ukutaht | 5 years ago
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...
bradleyjkemp|5 years ago
Indeed, on fast connections the request to Plausible gets cancelled before it can be completed. I've updated my code to use that `setTimeout` trick.
`navigator.sendBeacon` support would be amazing! I really like how simple Plausible has been to set up (having never really used analytics before) so removing even more pitfalls/hurdles would be cool