Getting started

Bugbattle JavaScript SDK Intro

The Bugbattle SDK for JavScript is the easiest way to integrate Bugbattle into your apps! Achieve better app quality & ratings with comprehensive in-app bug reporting. BugBattle offers affordable In-App Bug Reporting for Apps, WebApps & Websites.

❤️ Demo

https://jssdk.bugbattle.io/demo

🚀 Getting started

For the SDK to work, you need an API Token. Start your 14-day free trial at app.bugbattle.io to get your API token.

Installation

Install the bugbattle package via npm or yarn.

npm install bugbattle --save

Import the bugbattle package.

import BugBattle from 'bugbattle';
// Import the Bugbattle CSS
import "bugbattle/build/index.css";
// Optionally: <link href="https://jssdk.bugbattle.io/latest/index.css" rel="stylesheet">

Initialize the SDK

Add the following code to to initialize the BugBattle JavaScript SDK. Replace "YOUR-SDK-TOKEN-HERE" with your actual SDK token from the Bugbattle dashboard.

BugBattle.initialize("YOUR-SDK-TOKEN-HERE", BugBattle.FEEDBACK_BUTTON);

Congrats, you are now all set! Report your first bug by using the feedback button.

🤤 Customization

You can track more data (i.e. the app build number, version code or custom data) by using one of the following functions.

// Sets the main color (color schema).
BugBattle.setMainColor("#086EFB");
// Sets the app's build number.
BugBattle.setAppBuildNumber(5);
// Sets the app's version code.
BugBattle.setAppVersionCode("v5.0");
// Attaches custom data to the bug reports.
BugBattle.setCustomData({
test1: "Battle",
data2: "Unicorn"
});
// Enables the privacy policy check.
BugBattle.enablePrivacyPolicy(true);
// Sets the privacy policy.
BugBattle.setPrivacyPolicyUrl("https://someawesomesite...");
// Enables the automatic detection of crashes.
BugBattle.enableCrashDetector(true);

🤠 Activation methods

Currently you can choose between two activation methods, that initiate the bug reporting workflow.

// This will add a feedback bottom to the page
BugBattle.FEEDBACK_BUTTON
// This allows you to manually trigger the bug reporting workflow
BugBattle.NONE

If you want to manually trigger the bug reporting workflow, simply call the following method:

// Initiates the bug reporting workflow.
BugBattle.startBugReporting();

🤝 Need help?

We are here to help! hello@bugbattle.io