0.0.3 • Published 6 months ago

@rosnik/browser-sdk v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago