npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@betterbugs/web-sdk

v0.0.34

Published

A web sdk package for Betterbugs

Readme

BetterBugs Web SDK

Simplify bug reporting within your web apps with the BetterBugs Web SDK.

The BetterBugs Web SDK allows you to include bug reporting capabilities in your application with minimal settings and effort.

Now, you can enhance your apps with user-friendly and easy-to-implement issue reporting capabilities, such as media capturing, log tracking, getting the two-minute Rewind session video, and real-time hooks to help you and your team report, diagnose, and fix issues effectively.

Breaking it down

Using the BetterBugs Web SDK, you can enhance your web apps with bug reporting features that allow you to capture useful data about the issues. Here's more on it.

Key features of the SDK

  • Seamless integration — Quick installation and easy to use with a few lines of code.
  • Configurable params — Tweak settings for the parameters, such as metaData, recordType, enableAnnotation, and many others.
  • Use Methods — Control the SDK with programmatic methods, such as show(), hide(), startRecording(), and many others.
  • Event hooks — For deeper integration, listen for specific lifecycle events with hooks, such as after a screenshot is captured (screenshot), a bug is submitted (bugSubmit), or a recording starts (recordingStop), and many others.
  • Session Rewind (coming soon) – Automatically records the last 2 minutes of a session to capture all user interactions. It's perfect for auto-capturing issues that just happened and helps trace actions that lead to the bug.
  • Floating widget customization – Control the widget's look and placement.

Quick installation

To install the SDK, use the following command:

NPM install

npm install @betterbugs/web-sdk

Yarn install

yarn add @betterbugs/web-sdk

BetterBugs Web SDK initialization: Usage example

After installation, here's how to initialize the SDK instance in your web app:

TypeScript

import { Betterbugs } from '@betterbugs/web-sdk';

new Betterbugs({
  apiKey: process.env.TEST_API_KEY || '',
  mode: 'production',
});

Overview of the example code

Here's what it does:

1 - Imports the Betterbugs SDK — Pulls in Betterbugs from the @betterbugs/web-sdk package.

2 - Creates a new instance — The configuration object sets options for:

  • apiKey: Get value from environment variable (process.env.PROJECT_API_KEY).
  • mode: Running in production environment for additional debugging features.

Configurable Options: Customize SDK behavior

You can customize the SDK behavior with the following parameters:

| Option | Type | Description | | --------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | apiKey | string | Project-specific API* (required) | | metaData | Record<string | number, string | number | null> | Custom metadata to attach to reports (e.g., { userId: 123 }) | | recordType | "recordVideo" | "domRecord" | The "recordVideo" type (recommended for SPAs) is the traditional media recording method for video and audio. The "domRecord" type (recommended for Multi Page Apps) is the DOM recording method and may not be as accurate as the "recordVideo" type. | | disableScreenshot | boolean | Disable screenshot capturing | | disableRecording | boolean | Disable screen recording | | enableAnnotation | boolean | Enable annotation tools for screenshots. | | showActionButton | boolean | Display/Hide the floating action button. | | position | { top? : string, left? : string, right? : string, bottom? : string } | Control the widget's screen position. | | mode | "development" | "production" | Set development or production mode.The "development" mode can be set when the app is under development, and the "production" mode is for end-users, meaning the app's customers can report a bug in the live environment. | | email | string | The user's email address who is reporting the bug. Works only in "production" mode. | | styles | { theme?: 'light' | 'dark'; primaryColor?: string; primaryTextColor?: string; } | Set the styles of the widget | | actionButtonComponent | React.ReactNode | string | Component for the action button (React component or HTML string accepted). | | successMessageHeaderText | string | Main heading text of the success message. | | successMessageSubHeaderText | string | Sub heading text of the success message. | | maxRecordingMinutes | number | Set maximum recording length | | emailFieldLabel | string | Set label of email field | | emailFieldPlaceholder | string | Set placeholder of email field | | titleFieldLabel | string | Set label of title field | | titleFieldPlaceholder | string | Set placeholder of title field | | descriptionFieldLabel | string | Set label of description field | | descriptionFieldPlaceholder | string | Set placeholder of description field |

Programmatic Methods: Control SDK behavior

Available methods for controlling the BetterBugs SDK behavior;

| Method | Description | | ------------------- | ------------------------------------- | | setEmail() | Update the email of the bug reporter. | | setStyles() | Update the styles of the widget. | | getStyles() | Get the styles of the widget. | | show() | Show the floating widget | | hide() | Hide the floating widget. | | openWidget() | Open the bug report widget. | | closeWidget() | Close the bug report widget. | | setMetadata() | Update the attached metadata. | | captureScreenshot() | Trigger screenshot capture. | | startRecording() | Start session recording. | | stopRecording() | Stop the ongoing recording. | | on() | Register an event listener. | | off() | Unregister an event listener. | | destroy() | Destroy the BetterBugs instance. |

Lifecycle Event Hooks: For deeper integrations

Available hooks to listen to the lifecycle events:

| Event | Trigger description | | ---------------- | ------------------------------------------- | | emailUpdate | Triggered when the email is updated. | | screenshot | Triggered after the screenshot is captured. | | recordingStart | Triggered when the recording starts. | | recordingStop | Triggered when the recording stops. | | bugSubmit | Triggered after the bug is submitted | | metaDataUpdate | Triggered when the metadata is updated | | positionUpdate | Triggered when the widget position changes. | | widgetOpen | Triggered when the widget is opened. | | widgetClose | Triggered when the widget is closed. | | showActionButton | Triggered when the action button is shown. | | hideActionButton | Triggered when the action button is hidden. | | sessionCreated | Triggered when a new session is created. |

Floating widget customization options

The floating widget can be customized in various ways:

  • Positioning — Define widget position using { top, left, right, bottom }.
  • UI Customization — Modify button styles, background, and primary colors.