Introduction

Bugster SDK is a powerful tool for capturing and analyzing user interactions on your website. This API reference provides detailed information about the SDK’s configuration options and methods.

Installation

To install Bugster SDK, use npm:

npm install @bugster/bugster-js

Configuration

The Bugster SDK is initialized with a configuration object of type BugsterConfig.

BugsterConfig
object

Initialization

To initialize the Bugster SDK:

import BugsterTracker from '@bugster/bugster-js';

const bugster = new BugsterTracker({
  apiKey: 'YOUR_API_KEY',
  // other configuration options
});

Methods

identify

Identify a user with a unique ID and optional properties.

identify
function
bugster.identify('user123', { name: 'John Doe', email: 'john@example.com' });

capture

Capture a custom event with optional properties.

capture
function
bugster.capture('button_clicked', { buttonId: 'submit-form' });

Automatically Captured Events

Bugster SDK automatically captures several types of events:

  • $pageview: When a user views a page
  • $pageleave: When a user leaves a page
  • $click: When a user clicks on an element
  • $input: When a user interacts with an input field
  • $change: When an input value changes
  • $submit: When a form is submitted

Each of these events includes detailed information about the interaction and the element involved.

ElementData

When capturing element interactions, Bugster SDK collects the following data:

ElementData
object

Best Practices

  1. Initialize the SDK as early as possible in your application lifecycle.
  2. Use meaningful event names and properties to make analysis easier.
  3. Be cautious about capturing sensitive information, especially in input fields.
  4. Regularly review your captured data to ensure you’re tracking the most valuable interactions.

For more information on how to use Bugster SDK effectively, please refer to our Best Practices Guide.