Developer guide

    Use recommendations anywhere

    Fetch explainable product recommendations for a user and render them in your website, email service, app, or agent workflow.

    Endpoint

    The endpoint returns a ready-to-render recommendations array. Use the tenant project key and the user ID captured by your application.

    GET https://analytics.tradly.dev/recommendations/{project_key}/users/{user_id}?limit=6

    cURL

    curl "https://analytics.tradly.dev/recommendations/{project_key}/users/{user_id}?limit=6"

    The recommendation endpoint is public for the project and does not require a private customer profile or contact details.

    Website integration

    const response = await fetch(
      "https://analytics.tradly.dev/recommendations/your-project/users/user-123?limit=6"
    );
    const { recommendations } = await response.json();
    
    recommendations.forEach((product) => {
      // Render product.title, product.image_url, product.url, and product.price
      console.log(product.title, product.reason);
    });

    Lightweight embed

    There is no hosted iframe widget yet. This small copy-paste block is the current embed option and lets you control the markup and styling.

    <div id="tradly-recommendations"></div>
    <script>
      async function loadRecommendations() {
        const response = await fetch(
          "https://analytics.tradly.dev/recommendations/your-project/users/user-123?limit=6"
        );
        const data = await response.json();
        document.querySelector("#tradly-recommendations").innerHTML =
          (data.recommendations || []).map((product) =>
            `<a href="${product.url || "#"}">
              <img src="${product.image_url || ""}" alt="${product.title || "Recommended product"}">
              <strong>${product.title || product.listing_slug || product.listing_id}</strong>
              <span>${product.reason}</span>
            </a>`
          ).join("");
      }
      loadRecommendations();
    </script>

    1

    Capture

    The pixel and application events build behavior memory.

    2

    Request

    Call the endpoint when a page, email, or app needs recommendations.

    3

    Render

    Show the returned products and short explanation wherever the customer is.

    Install the tracking pixel