Skip to main content
The Orwel SDK is a lightweight, powerful library for tracking human behavior, identifying visitors, and monitoring application performance. It automatically captures a wide range of events to power the Personality Engine.

Installation

Install the SDK via npm or yarn:
npm install orwel
# or
yarn add orwel

Initialization

Initialize the SDK at the root of your application (e.g., App.tsx, main.js).
import orwel from 'orwel';

orwel.init({
  apiKey: 'orwel_pk_...', // Your Public API Key
  autoMonitor: true,      // Enable performance and error monitoring
  debug: false            // Enable console logs for debugging
});

Core Methods

Identify

Associate a visitor with a unique ID and traits. Call this when a user logs in or updates their profile.
orwel.identify({
  email: 'user@example.com',
  name: 'Jane Doe',
  plan: 'premium',
  role: 'admin'
});

Track

Track custom events to measure specific user actions.
orwel.track('feature_used', {
  feature_name: 'dark_mode',
  source: 'settings_panel'
});

Conversion

Track high-value conversion events.
orwel.conversion('purchase', {
  amount: 99.00,
  currency: 'USD',
  items: ['sku_123', 'sku_456']
});

Session

Update session properties or mark a session as active.
orwel.session({
  cart_value: 150.00,
  current_step: 'checkout'
});

Form Tracking

Manually track complex forms (though auto-tracking handles most cases).
const form = document.getElementById('signup-form');
orwel.form(form, {
  trackFocus: true,
  trackAbandon: true
});

Auto-Tracking

When autoMonitor is enabled, Orwel automatically detects and tracks the following events without any additional code.
  • page_view: Page loads and route changes.
  • click: Clicks on interactive elements.
  • scroll: Scroll depth milestones.
  • hover: Meaningful hovers over elements.
  • search: Search queries performed.
  • form_abandon: Forms started but not submitted.

Technical & Performance

  • js_error: JavaScript runtime errors.
  • network_request_failed: Failed API calls.
  • file_download: Downloads of PDF, ZIP, etc.
  • timing_complete: Performance milestones.

Engagement

  • video_play, video_progress, video_complete: HTML5 video interactions.
  • select_content: Text selection or content interaction.
  • share: Usage of native share APIs.

Ecommerce (Auto-detected from DOM structures)

  • add_to_cart
  • begin_checkout
  • purchase