fullstory-browser-sdk
fullstory-browser-sdk copied to clipboard
Failure Detection Handler
Problem
If a user is using a ad blocker, sometimes it will not start up fullstory. I would like the ability to catch if the error occurs and handle it.
Proposal
You could do something like make Fullstory.init
return a Promise and error if it fails, so you could do:
(async () => {
try {
await Fullstory.init({ orgId: 'asdf' });
} catch (e) {
alert('Kindly turn that ad blocker off');
}
}();
Hey Austin! Thanks for proposing this, sorry for the delayed reply. Let me circle back with some other folks on my team to review.
I ended up using this: https://www.npmjs.com/package/use-ad-block-detection - would be nice to have this built in though.
The way these ad blockers typically work is blocking the URL pattern to the recording script fs.js
. It would be useful to have even a naive timeout on whether FS is ever loaded into the window
. Another use case is content-security-policy that could also block fs.js
. Thanks for bringing it up.
@van-fs - Yup - the ad block hook I demonstrated above just tries to request the script and when it fails it handles the exception. This of course causes duplicate calls ( though cached ) so it would be grat to handle this in the lib itself.