1.1.1 • Published 10 months ago

@mentoor.io/hazelnut-client v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Hazelnut Browser SDK

This is a simple SDK that allows you to interact with Hazelnut for event and errors tracking.

Installation

yarn add @mentoor.io/hazelnut-client

Or

npm i @mentoor.io/hazelnut-client

Or

pnpm add @mentoor.io/hazelnut-client

Configurations

In your entry point of the project, you can initialize the SDK with the following code:

import { hazelnut } from "@mentoor.io/hazelnut-client";

hazelnut.init({
  apiKey: "YOUR_API_KEY",
  captureUncaughtErrors: true, // default to true
  environment: process.env.NODE_ENV, // default to "production"
  get user() {
    return {
      id: "USER_ID",
      email: "USER_EMAIL",
      // any other user data
    };
  },
});

Usage

Now usage is pretty much straight forward. You can use the SDK to track events and errors.

import { hazelnut } from "@mentoor.io/hazelnut-client";

hazelnut.track("event_name", {
  // any event data
});

By default hazelnut fires a session.started session.ended and app.closed events.

For tracking errors, pass the Error instance to the error method.

import { hazelnut } from "@mentoor.io/hazelnut-client";

try {
  // some code that might throw an error
} catch (error: Error) {
  hazelnut.error(error);
}

License

This SDK is licensed under the MIT License.

TODO

  • Add tests
  • Add more options to control default fired events names
1.1.1

10 months ago

1.1.0

12 months ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago