🐛 Handle GA script load failure to prevent bot from hanging (#2446)

## Summary
- Add `script.onerror` handler in `initGoogleAnalytics` so the promise
resolves even when the GA script fails to load (ad blockers, network
errors), preventing the bot from hanging indefinitely.
- Bump `@typebot.io/js` and `@typebot.io/react` versions to `0.10.2`.

## Test plan
- [ ] Enable a Google Analytics integration block in a bot
- [ ] Block `googletagmanager.com` (e.g. via ad blocker) and verify the
bot still loads
- [ ] Check that `"Failed to load Google Analytics script"` appears in
the console

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Baptiste Arnaud 2026-04-13 12:18:57 +02:00 committed by GitHub
parent 0969c4e525
commit d3c15f32c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.10.1",
"version": "0.10.2",
"description": "Javascript library to display typebots on your website",
"license": "FSL-1.1-ALv2",
"type": "module",

View File

@ -34,6 +34,10 @@ export const initGoogleAnalytics = (id: string): Promise<void> => {
script.onload = () => {
resolve();
};
script.onerror = () => {
console.error("Failed to load Google Analytics script");
resolve();
};
}
if (existingScript) resolve();
});

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.10.1",
"version": "0.10.2",
"description": "Convenient library to display typebots on your React app",
"license": "FSL-1.1-ALv2",
"type": "module",