Svelte app example
Quick installation guide to setup the BetterBugs Web SDK widget for your Svelte applications.
How to install BetterBugs Web SDK in Svelte apps
3
Initialize the SDK (with default UI)
<script>
// BetterBugs SDK Initialization Code
import { onMount, onDestroy } from 'svelte';
let bbInstance = null;
onMount(async () => {
if (typeof window !== 'undefined') {
const { default: Betterbugs } = await import('@betterbugs/web-sdk');
bbInstance = new Betterbugs({
// Replace with your BetterBugs Project API Key
apiKey: 'YOUR-API-KEY-GOES-HERE',
});
}
});
onDestroy(() => {
bbInstance?.destroy?.();
});
</script>
<h1>BetterBugs Web SDK Widget | Svelte</h1>4
Customize the SDK widget UI (Optional)
<script>
// BetterBugs SDK Initialization Code
import { onMount, onDestroy } from 'svelte';
let bbInstance = null;
onMount(async () => {
if (typeof window !== 'undefined') {
const { default: Betterbugs } = await import('@betterbugs/web-sdk');
bbInstance = new Betterbugs({
// Replace with your BetterBugs Project API Key
apiKey: 'YOUR-API-KEY-GOES-HERE',
// UI Customization Examples
position: {
top: "30px",
right: "20px",
},
styles: {
primaryColor: "#e41c38",
primaryTextColor: "#fff",
theme: "light",
},
});
}
});
onDestroy(() => {
bbInstance?.destroy?.();
});
</script>
<h1>BetterBugs Web SDK Widget | Svelte</h1>Last updated