Vue app example
Quick installation guide to setup the BetterBugs feedback widget for your Vue applications.
How to Install BetterBugs Feedback Widget in Vue apps
Here are the steps for it:
Initialize the Widget (with default UI)
Use the following initialization code in your Vue app’s component. Add your BetterBugs Workspace-Wide API key and Project ID to the code.
<!-- Vue Template -->
<template>
<h1>BetterBugs Web SDK Widget | Vue</h1>
</template>
<script setup>
import { onMounted, onBeforeUnmount, ref } from "vue";
const bbInstanceRef = ref(null);
onMounted(async () => {
if (typeof window !== "undefined") {
const { default: Betterbugs } = await import("@betterbugs/web-sdk");
const instance = new Betterbugs({
apiKey: "YOUR_API_KEY_HERE", // Workspace API key
projectId: "YOUR_PROJECT_ID_KEY_HERE", // Project to report bugs to
});
bbInstanceRef.value = instance;
}
});
onBeforeUnmount(() => {
bbInstanceRef.value?.destroy?.();
});
</script>Customize the Widget UI (Optional)
You can customize the SDK with your brand colors and design from the initialization function:
<!-- Vue Template -->
<template>
<h1>BetterBugs Web SDK Widget | Vue</h1>
</template>
<script setup>
// BetterBugs SDK Initialization Code
import { onMounted, onBeforeUnmount, ref } from "vue";
const bbInstanceRef = ref(null);
onMounted(async () => {
if (typeof window !== "undefined") {
const { default: Betterbugs } = await import("@betterbugs/web-sdk");
const instance = new Betterbugs({
apiKey: "YOUR_API_KEY_HERE", // Workspace API key
projectId: "YOUR_PROJECT_ID_KEY_HERE", // Project to report bugs to
// UI Customization Examples
position: {
top: "30px",
right: "20px",
},
styles: {
primaryColor: "#e41c38",
primaryTextColor: "#fff",
theme: "light",
},
});
bbInstanceRef.value = instance;
}
});
onBeforeUnmount(() => {
bbInstanceRef.value?.destroy?.();
});
</script>The feedback widget should be available at the bottom right side of your app screen (with the default UI).
NOTE: If the widget is not visible,
Please check if you’ve correctly entered the API key and project ID.
Check for the console errors, if any.
If you’re still stuck, try running your dev server in the INCOGNITO mode of your web browser.
Some ad blockers or extensions may also prevent the Widget from running. Please turn them off and try running the application again. It should work fine.
You're good to go.
Last updated