Experience Platform
JS SDK

Vanilla JS SDK

@shellapps/experience — the core SDK that works in any JavaScript environment (browser, React, Vue, vanilla).

Installation

npm install @shellapps/experience

Initialisation

import { Experience } from '@shellapps/experience';
 
const exp = Experience.init({
  // Required
  appId: 'my-app-id',
  apiKey: 'exp_xxxxxxxxxxxx',
 
  // Optional
  endpoint: 'https://experience.shellapps.com',  // default
  enableTracking: true,                           // default true
  enableErrorCapture: true,                       // default true
  enableHeatmaps: false,                          // default false (high volume)
  enableBreadcrumbs: true,                        // default true
  sampleRate: 1.0,                                // 0.0-1.0, default 1.0
  batchIntervalMs: 2000,                          // default 2000
  maxBatchSize: 50,                               // default 50
  debug: false,                                   // default false (console logging)
});

Event Tracking

// Manual tracking
exp.track('checkout_started', { cart_value: '99.99' });
exp.trackPageView();  // manual page view (auto by default)

Events are batched and sent via protobuf. See Event Tracking for the full data-t system, batching, and heatmap details.

Error Capture

exp.captureError(new Error('Payment failed'), {
  tags: { module: 'checkout' },
  extra: { orderId: '12345' }
});
 
exp.captureMessage('Unusual cart value detected', 'warning');

See Error Monitoring for automatic capture, breadcrumbs, and crash UI.

Feature Flags

const showNewUI = exp.getFlag('new-checkout-ui', false);
const checkoutLimit = exp.getFlag('checkout-limit', 100);

See Feature Flags for rule evaluation, rollouts, and experiments.

Identity

// Link to ShellApps profile
exp.identify(profileId);

Shutdown

// Flush pending events before page close
exp.shutdown();

Configuration Reference

OptionTypeDefaultDescription
appIdstringrequiredYour app ID from registration
apiKeystringrequiredAPI key (exp_xxxxxxxxxxxx)
endpointstringhttps://experience.shellapps.comService endpoint
enableTrackingbooleantrueEnable event tracking
enableErrorCapturebooleantrueEnable automatic error capture
enableHeatmapsbooleanfalseEnable heatmap data (high volume)
enableBreadcrumbsbooleantrueEnable breadcrumb collection
sampleRatenumber1.0Session sampling rate (0.0–1.0)
batchIntervalMsnumber2000Batch send interval in ms
maxBatchSizenumber50Max events per batch
debugbooleanfalseEnable console logging

Also see the React SDK for React-specific hooks and components.


© 2026 Shell Technology. All rights reserved.