Sleek’s SDK can extract product information from the pages your users are visiting. To enable this experience for your users, you’ll need to call Sleek on the pages that you want to extract product information from. This documentation will guide you through the integration process.
This document assumes that you have already integrated the Sleek SDK into your extension. If you haven’t, please refer to the SDK integration guide.

Enable product extraction

After Sleek is installed and setup in your extension, you are ready to extract product information from the pages your users are visiting. To extract product information from a page, you can use the unified extractProductsOnTab method which will automatically determine the page type and extract the appropriate product information:
import { getSdkInstance } from "@sleek/web-ext-coupon-sdk";

const products = await getSdkInstance().extractProductsOnTab(tabId);
// Returns Promise<Product | Product[] | undefined>

// With options
const productsWithCategory = await getSdkInstance().extractProductsOnTab(tabId, {
  includeCategory: true
});
The extractProductsOnTab method will return:
  • A single Product object for product detail pages
  • An array of Product objects for cart pages
  • undefined if no products are found
The Product type includes the following fields:
type Product = {
    name: string | null;
    price: number | null;
    currencyCode: string | null;
    quantity: number | null;
    imageUrls: string[] | null;
    description: string | null;
    categoryId: string | null;
    categoryBreadcrumb: string | null;
    categoryVersion: string | null;
    brandName: string | null;
    gtin: string | null;
    mpn: string | null;
    sku: string | null;
    asin: string | null;
};
The older methods extractProductDetailProductOnTab, extractCartProductsOnTab, extractProductsOnTab (previous version), and extractExtendedProductsOnTab are now removed and only extractProductsOnTab will be supported, moving forward.
Sleek will only return products on pages that are classified as product or cart. To determine the page classification, you can use the classifyPageOnTab method. See the page classification guide for more information.
What’s next: Now that you have enabled product extraction in your extension, you can check out the TypeDoc for specific event types and methods on the SDK.

View TypeDoc

Browse the reference TypeDoc for the SDK.