Integrate Javascript SDK
This document will cover Javascript SDK installation and initialization steps for your web application
This is v1 version of @suprsend/web-sdk
We have changed the web SDK authentication from workspace key-secret to public key and JWT based authentication in v2. This is done to improve security in frontend applications.
- For migrating to v2, follow this guide
- Refer the v2 SDK documentation
- Github repository v1 version of this SDK.
Installation
Install SDK using npm / yarn
npm i @suprsend/web-sdk
yarn add @suprsend/web-sdk
Initialization
Use SDK's init
method to initialize the SuprSend SDK.
Once you initialize the sdk you can use all methods available in it. Make sure to initialize it before calling other methods of it. If you are using create-react-app, initialize it on top of App class in App.js
.
import suprsend from "@suprsend/web-sdk";
suprsend.init(WORKSPACE_KEY, WORKSPACE_SECRET)
Replace WORKSPACE KEY and WORKSPACE SECRET with your workspace values. You will get both the tokens from Suprsend dashboard (Settings page -> "API keys" section). For more details, check the documentation on 'Workspaces'.
Updated 3 months ago