@rosnik/browser-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

browser-sdk

ROSNIK Browser SDK

Getting Started

Install

npm add @rosnik/browser-sdk

Configuration

Then in your application code:

import { Rosnik } from "@rosnik/browser-sdk"
Rosnik.init({
  apiKey: 'api-key',
  allowedDomains: ["api.example.com"]
})

We'll send Journey IDs to the domains allowed. This allows you to connect events across the frontend and backend. Alternatively, you can send these headers yourself by not setting allowedDomains, in which case we won't patch fetch.

To set active user context:

Rosnik.setUser("user-id")

Tracking Events

You can track the following events:

  1. User interactions, e.g. "edit text"
Rosnik.trackUserTextEdit({before: string, after: string })
  1. Explicit user feedback
Rosnik.trackUserFeedback({ score: number, openFeedback: string });
  1. Goal completion
Rosnik.trackUserGoal({goalName: string})

Compatibility notes

We patch fetch using fetch-intercept so there are some browsers where we won't automatically send headers to the AI service: https://caniuse.com/?search=fetch

Package Sidebar

Install

npm i @rosnik/browser-sdk

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

25.8 kB

Total Files

18

Last publish

Collaborators

  • nickdirienzo