Skip to main content
The @sleek/sdk package provides the foundational JavaScript SDK for Sleek, supporting multiple bundling formats (IIFE, ESM, CJS). You can use it directly in web pages via script injection or install it via a package manager in modern frontend setups. This guide walks you through installation, setup, and core usage of the SDK.
Before you start, ensure that you have your Sleek credentials on hand. Contact support if you need help with your credentials.

Installation

If you’re planning to use the SDK via script injection (IIFE), you do not need to install it via a package manager. Just follow the IIFE Usage section.

Install via NPM (CJS / ESM)

The @sleek/sdk package is hosted on Sleek’s private package repository.

Configure .npmrc

Replace {YOUR_TOKEN_HERE} with your SDK access token.

Add to your project

IIFE Usage

If you’re injecting the SDK into pages (e.g., via script tags), you can use the IIFE bundle directly.

Download SDK package

This will extract the SDK files locally. You will need the following files:
  • sdk.iife.js: The main SDK file
  • f.js: A supporting script required for the SDK to function properly in-page

Inject into the Page

Make sure these files are injected into the page before any other scripts, ideally at the top of the <head>:
The sleek object will be available on globalThis.

Initialization

Call initializeSdk with your public Sleek API key to initialize the SDK:
Once initialized, retrieve the SDK instance:

Core Features

The @sleek/sdk provides a tab/page-agnostic interface that powers: Refer to the TypeDoc reference for full API documentation.

Events

To listen for SDK events, pass an array of listener functions to initializeSdk as the third argument:
Each listener receives an event of type SdkEvent.

File Formats

What’s Next

Once you’ve installed and initialized the SDK, you can extend your integration with:

Enable coupon auto-apply

Learn how to enable coupon auto-apply.

Page classification

Learn how to enable page classification.

Product extraction

Learn how to enable product extraction.

Order extraction

Learn how to enable order extraction.

View TypeDoc

Browse the reference TypeDoc for the SDK.

Need help? Contact our support team.