Skip to main content
This guide explains how to retrieve product collections using the Product Recommendation API without embedding the Kameleoon HTML element. Use the following endpoint:

Why use the API?

Use the API for mobile applications.
Depending on your needs, this approach offers multiple benefits:
  • Full Control: Customize the variation display to match your design and UX standards.
  • Better Performance: Use optimized API calls to reduce page load delays compared to script-based solutions.
  • Easier Debugging: Log, monitor, and debug integrations within your client codebase using standard tools.
  • No Third-Party Script Dependency: Use direct calls to avoid external scripts, reduce potential conflicts, and align with security policies.
  • SPA-Friendly: Integrate directly into single-page applications to avoid timing issues and fit into client-side routing.
  • Ad Blocker Resilience: Deliver experiments consistently without third-party scripts or specific HTML markers. For more details on how ad blockers affect Kameleoon, see the FAQ.

Goal

Retrieve a product collection from the recommendation engine and render it on your frontend. For example, the following image shows a collection rendered on a homepage:
Product Collections

Requirements

  • A valid Kameleoon account with a Store ID (shop_id).
    • Get your shop_id from Recommendations > Settings > Store settings in the Kameleoon app. Contact your Customer Success Manager for the key if necessary.
Store Key
  • A collection_id from the Product Collections section of the dashboard. This section lists your configured collections and their IDs.
Collection ID
  • A Device ID (did) and Session ID (sid). (Required only when using filters or algorithms that rely on historical device/user data).
    • For Kameleoon Web Experimentation, get these from the following cookies:
      • KameleoonProducts_device_idDevice ID (did)
      • KameleoonProducts_session_codeSession ID (sid)
    • Otherwise, generate these values manually.

Steps

1. Retrieve cookies (Kameleoon Web Experimentation only)

Generate these values manually for backend implementations or environments without Kameleoon Web Experimentation. Refer to the Init endpoint for details.

2. Query request

Endpoint:
Replace {collection-id} with the value from Requirements.
To personalize the collection for users across platforms, use the external_id configured as Kameleoon Custom Data instead of the did.
Example:

3. Response

The mobile app can ignore html.
The API does not return CSS; you must style the output manually.
Example: