jehna / ga-lite

Small, cacheable and open version of Google Analytics JS client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Illegal Invocation error due to lack of navigator.sendBeacon binding

brandoncarl opened this issue · comments

Hello – in certain cases navigator.sendBeacon fails to bind correctly causing an Illegal Invocation error in ga-lite. This can cause hundreds of errors per day:

image

The phenomenon is not specific to ga-lite and is documented here:
https://xgwang.me/posts/you-may-not-know-beacon/

vercel.js encountered the same issue here:
vercel/next.js#23856

And addressed it here:
https://github.com/vercel/next.js/pull/26601/files

I believe the fix should be straightforward (binding sendBeacon to navigator).

Thanks for the great work.

Great, thank you for reporting high quality issue! 🙏