0.0.9 • Published 1 year ago

survaii-session-stream v0.0.9

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
1 year ago

Survaii Session Stream

Survaii Session Stream allows you to record user sessions effortlessly, capturing valuable insights into user interactions with your application.

Getting Started

Follow these simple steps to integrate and use Survaii Session Stream in your project.

Prerequisites

  1. AppKey: Ensure you have an AppKey from Survaii.

Installation

Install the Survaii Session Stream library via npm:

npm install survaii-session-stream

Usage

  1. Import the Library:

    import { SurvaiiSessionStream } from 'survaii-session-stream';
  2. Initialize the Recorder:

    Call the init function to initialize the recorder. The init function takes four parameters, with the ID, Interval and MaskAllInputs parameters being optional:

    • AppKey: Your Survaii AppKey.
    • ID: (Optional) A unique identifier for the session (e.g., an email or a database ID). This is useful for recording sessions of authenticated users.
    • Interval: (Optional) The interval in milliseconds to capture small chunks of the session (default is 30000 ms). This ensures you don't miss anything even if the user exits your app abruptly.
    • MaskAllInputs: (Optional) When set to true, all input fields will have their values masked to prevent sensitive information from being recorded. This is useful for maintaining privacy and security.
    SurvaiiSessionStream.init(
    'your-app-key', // Replace with your AppKey
      'unique-user-id', // Optional: Replace with your unique identifier
      30000, // Optional: Adjust the interval as needed
      true, // Optional: Mask all inputs
    );
  3. Start Recording:

    To start recording the session, call the startRecording function:

    SurvaiiSessionStream.startRecording();
  4. Stop Recording:

    If you need to stop recording the session, call the stopRecording function:

    SurvaiiSessionStream.stopRecording();

Example

Here is a complete example of how to use Survaii Session Stream:

import { SurvaiiSessionStream } from 'survaii-session-stream';

// Initialize the recorder
SurvaiiSessionStream.init({
  id: 'user@example.com', // Optional: Replace with a unique identifier
  interval: 30000, // Optional: Adjust the interval as needed
  appKey: 'your-app-key', // Replace with your AppKey
});

// Start recording the session
SurvaiiSessionStream.startRecording();

// Optionally, stop recording the session when needed
// SurvaiiSessionStream.stopRecording();

Conclusion

That's it! You are now ready to start recording user sessions with Survaii Session Stream. This will help you gain valuable insights into how users interact with your application, allowing you to make informed decisions to improve the user experience.

If you have any issues or need further assistance, please contact us at contact@survaii.io.