@stey/web-sdk v0.1.0-beta.1
web-sdk
The javascript SDK of stey.ai record for session replay
Installation
To use @stey/web-sdk
in your project, you need to install it into your project via npm
or yarn
. Here are the instructions for installation.
Install with npm
:
npm install @stey/web-sdk
Install with yarn
:
yarn add @stey/web-sdk
Usage
After installing @stey/web-sdk
, you can use it in your application following these steps.
Import SDK
In your TypeScript or JavaScript file, you need to import the SDK. This can be done with the following code:
import { steyAIRecord } from '@stey/web-sdk';
Initialize SDK
Initialize the SDK as early as possible in your application. This is typically done at the entry point or during the initialization phase.
steyAIRecord.initialize('YOUR_PROJECT_KEY');
Replace 'YOUR_PROJECT_KEY'
with the actual key for your project.
Set User Information
To identify a user, you can use the identify
method.
steyAIRecord.identify({
uid: 'USER_ID',
// additional user information
});
Make sure to replace 'USER_ID'
with a unique identifier for the user.
Set User Properties
To set user properties, use the userSet
method.
steyAIRecord.userSet({
// key-value pairs of user properties
});
Change SDK Mode
The SDK mode can be changed via the setMode
method.
// mode can be 'debug' or 'production'
steyAIRecord.setMode('production');
Replace 'YOUR_MODE'
with the desired mode.
Enable Tracing
To enable console.trace, you can use the openTrace
method.
steyAIRecord.openTrace();
Disable Tracing
If you need to disable tracing features, you can use the closeTrace
method.
steyAIRecord.closeTrace();
Quickly Close SDK
If you need to close sessions by yourself, you can use the quicklyClose
method.
steyAIRecord.quicklyClose();
Considerations
- Make sure to initialize the SDK before calling any
steyAIRecord
methods. - Replace all placeholders such as
'YOUR_PROJECT_KEY'
and'USER_ID'
with the actual values for your project. - The SDK will automatically create global methods and variables upon loading, so ensure not to override these globals.
- The default will load latest version of the SDK, if you need to use a specific version
import { loadSDK } from '@stey/web-sdk';
loadSDK('x.x.x');
Following these steps should allow you to successfully install and use @stey/web-sdk
in your application. If you encounter any issues during use, please refer to the official documentation or contact technical support.
5 months ago
5 months ago