> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onsleek.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Product extraction

> Specific integration instructions to enable product extraction.

Sleek’s Web Extension 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.

<Warning>
  This document assumes that you have already integrated the Sleek web extension SDK into your
  extension. If you haven't, please refer to the [Web Extension SDK integration
  guide](/web-ext-sdk-reference/introduction).
</Warning>

## Enable product extraction

After Sleek Web Extension 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
`extractProducts` method which will automatically determine the page type
and extract the appropriate product information:

```javascript theme={null}
import { getWebExtSdk } from "@sleek/web-ext-sdk";

const products = await getWebExtSdk().onTab(tabId).extractProducts(); // Returns Promise<ExtractProductsResult>

// With options
const productsWithCategory = await getWebExtSdk().onTab(tabId).extractProducts({
  includeCategory: true
});
```

The `extractProducts` method returns an object based on the type of page:

* For `cart` pages, it returns:

```typescript theme={null}
{
  products: Product[] | null;
  productsNodeIds: ProductNodeIds[] | null;
  responseShape: 'cart';
}
```

* For `product` pages, it returns:

```typescript theme={null}
{
  product: Product;
  productNodeIds: ProductNodeIds | null;
  responseShape: 'product';
}
```

The `Product` type includes the following fields:

```typescript theme={null}
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;
};
```

Sleek will only return products on pages that are classified as
`product` or `cart`. To determine the page classification, you can use
the `classifyPage` method. See the [page classification
guide](/web-ext-sdk-reference/page-classification) 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 web extension SDK.

<Card title="View TypeDoc" icon="terminal" href="/web-ext-sdk-reference/type-doc">
  Browse the reference TypeDoc for the web extension SDK.
</Card>
