SDK overview
The Selektable client SDK is a lightweight JavaScript library that runs on your product pages. It manages the widget lifecycle, product context, identity tracking, and communication between your page and the widget iframe.Global object
After the embed script loads, it exposes a globalwindow.Selektable object with the following methods:
How it works
When the embed script loads, it:- Initializes identity: generates or restores visitor/session IDs from browser storage
- Discovers widget elements: scans the DOM for
data-selektable-widgetattributes - Manages iframes: creates, shows, hides, and communicates with widget iframes
- Handles cart operations: proxies add-to-cart requests between the widget and your callbacks
- Detects context: auto-detects product info, fonts, and translation service language
Widget states
Each widget instance goes through these states:
Calling
preload() moves the widget from idle to ready without showing it. Calling open() on an already ready widget shows it instantly with no loading spinner.
Browser support
All modern browsers are supported. The SDK uses standard web APIs (localStorage, sessionStorage, postMessage). If localStorage is unavailable (e.g., Safari private browsing), the SDK generates ephemeral IDs that don’t persist.