Sleek’s SDK automatically classifies the pages your users are visiting. To setup this experience for your users, you’ll need to provide Sleek with the pages that you want to classify. This documentation will guide you through the integration process.
This document assumes that you have already integrated the Sleek SDK. If you haven’t, please refer to the SDK integration guide.

Enable page classification

After Sleek SDK is installed and setup in your extension, you are ready to enable page classification.

Automatically classify pages

To automatically classify pages, set featureControls.emitPageClassification to true in the SDK’s options during initialization.
<script src="f.js"></script>
<script src="sdk.iife.js"></script>
<script>
  sleek.initializeSdk("YOUR_PUBLIC_API_KEY_HERE", {
    featureControls: {
      emitPageClassification: true,
    },
  },
  [
    (event) => {
      // `event` is typed, so is the data of the event `event.data` based on the type of the event.
      switch (event.type) {
        case SdkEventType.PAGE_CLASSIFIED:
          console.log("Page classification: ", event.data.classification);
          break;
      }
    }
  ]);
</script>
Now that you have enabled page classification, Sleek will automatically classify the pages your users are visiting and emit the PAGE_CLASSIFIED event when a page has been classified.

Manually classify pages

In addition to automatic emission of page class, you can manually classify a page by calling the classifyPage method.
<script src="f.js"></script>
<script src="sdk.iife.js"></script>
<script>
  sleek.initializeSdk("YOUR_PUBLIC_API_KEY_HERE");

  const classification = await sleek.getSdk().classifyPage(); // Returns Promise<PageClassification>
</script>

Available page classifications

The SDK can classify pages into the following categories:
  • cart - A shopping cart page
  • checkout - A checkout page
  • checkoutComplete - A completed checkout page
  • collection - A category/collection page listing products
  • customersAccount - A customer account page
  • customersAuthentication - A login or registration page
  • customersOrders - A customer orders history page
  • home - A website’s homepage
  • product - A product detail page
  • search - A search results page
  • other - An e-commerce page that doesn’t fit other categories
  • nonShopping - A page that is not shopping related
What’s next: Now that you have enabled page classification, you can check out the TypeDoc for specific event types and methods on the SDK.

View TypeDoc

Browse the reference TypeDoc for the SDK.