Bugpilot API docs
  • 👋Welcome!
  • HTTP API
    • Authentication
    • API Reference
      • Actions
      • Update Report
      • Session Info
  • Javascript SDK
    • Getting Started
      • Saving Bug Reports
Powered by GitBook
On this page
  • Overview
  • Prerequisites
  • Using the SDK
  • SDK Methods
  • Need help?

Was this helpful?

  1. Javascript SDK

Getting Started

This page helps you understand what's the SDK for and how to start generating bug reports with it.

PreviousSession InfoNextSaving Bug Reports

Last updated 1 year ago

Was this helpful?

Overview

The SDK for JavaScript is an easy way to start bug reporting from your app front-end.

If you are looking for a way to start screen recording, or collect bug reports, from your app back-end, from a server-side flow, check the instead.

Prerequisites

To get started with the SDK, you must follow these steps:

  1. for Bugpilot

  2. to your web app

  3. Recommended. Identify users

Using the SDK

The SDK methods are available on the global Bugpilot object.

Accessing the Bugpilot object

By default, the Bugpilot tracking code loads asynchronously, to minimize the impact on your pages performance. Before calling any SDK method, make sure the page has finished loading.

For traditional apps:

function doSomethingWithBugpilot() {
  window.Bugpilot.saveReport({
    source: "feedbackWidget",
    userProvidedDescription: `Feedback: ${feedback}`,
  });
}

window.addEventListener('load', doSomethingWithBugpilot);
if (document.readyState === 'complete') { doSomethingWithBugpilot(); }

For Single-Page-Apps: Call the SDK methods after your app has initialized and authenticated the users. You may also want to use the Optional Chaining operator to avoid throwing errors in case you call SDK methods while Bugpilot is not yet available:

window.Bugpilot?.saveReport?.({
  source: "feedbackWidget",
  userProvidedDescription: `Feedback: ${feedback}`,
});

SDK Methods

Here's what you can do with the SDK for JavaScript:

Need help?

Our team is always happy to chat with you! Talk to us using the chat widget in the bottom-right corner of your Bugpilot dashboard.

Bugpilot
HTTP API
Signup
Install the Bugpilot tracking code
Saving Bug Reports