### Full Product Page Integration Example (HTML) Source: https://docs.selektable.com/guides/custom-store This HTML example demonstrates a complete product page integration, including basic product details, buttons to add to cart and view in a room, and the Selektable embed script. It utilizes JavaScript functions to handle user interactions and open the Selektable widget with product information and cart callbacks. ```html
$899.00
``` -------------------------------- ### Handle Selektable SDK Loading Order (Option 1) Source: https://docs.selektable.com/sdk/installation When calling Selektable SDK methods from inline scripts, especially in SPAs, ensure the SDK is loaded first. This example shows how to check for `window.Selektable` before executing SDK functions. ```html ``` -------------------------------- ### Handle Selektable SDK Loading Order (Option 2) Source: https://docs.selektable.com/sdk/installation For scenarios where the SDK might not be immediately available, this option demonstrates using the `load` event listener to ensure SDK methods are called only after the script has fully loaded. ```html ``` -------------------------------- ### Configure Multiple Selektable Widgets Source: https://docs.selektable.com/sdk/installation A single Selektable embed script tag is sufficient for multiple widgets on a page. This example shows how to use `onclick` handlers to open different widgets, demonstrating the SDK's ability to manage multiple instances. ```html ``` -------------------------------- ### Verify Selektable SDK Loading in Console Source: https://docs.selektable.com/sdk/installation After embedding the script, check the browser's developer console to confirm that the `window.Selektable` object is available and contains the expected methods. This verifies the SDK has loaded correctly. ```javascript console.log(window.Selektable); // Should output an object with: open, close, preload, discover, identify, reset, getIdentity, setVisitorId ``` -------------------------------- ### JavaScript Example: Opening Selektable with Product Options Source: https://docs.selektable.com/sdk/product-options Demonstrates how to open the Selektable widget with product-specific options, including ID, title, image, and physical dimensions. This example shows a practical implementation of the ProductOptions object. ```javascript Selektable.open('widget_abc123', { productId: 'sofa-001', productTitle: 'Modern Blue Sofa', productImage: 'https://myshop.com/images/sofa.jpg', dimensions: { width: 220, height: 85, depth: 95, unit: 'cm' } }); ``` -------------------------------- ### Order Webhooks Source: https://docs.selektable.com/guides/custom-store Set up order webhooks to send purchase data to Selektable for conversion tracking and analytics. ```APIDOC ## POST https://app.selektable.com/api/webhooks/orders ### Description Receives order data from your system to track conversions and attribute them to Selektable interactions. ### Method POST ### Endpoint https://app.selektable.com/api/webhooks/orders ### Parameters #### Request Body - **orderId** (string) - Required - The unique identifier for the order. - **storeId** (string) - Required - The identifier for your store. - **customerEmail** (string) - Required - The email address of the customer. - **items** (array) - Required - An array of items included in the order. - **productId** (string) - Required - The unique identifier for the product. - **quantity** (number) - Required - The number of units purchased. - **price** (number) - Required - The price per unit. - **total** (number) - Required - The total amount of the order. - **currency** (string) - Required - The currency of the order (e.g., 'EUR', 'USD'). ### Request Example ```json { "orderId": "order-789", "storeId": "store_xxx", "customerEmail": "customer@example.com", "items": [ { "productId": "prod-456", "quantity": 1, "price": 899.00 } ], "total": 899.00, "currency": "EUR" } ``` ### Response #### Success Response (200) Typically returns a 200 OK status if the webhook is received successfully. Specific response body may vary. #### Response Example ```json { "message": "Order received successfully" } ``` ``` -------------------------------- ### Configure Selektable Widget with Data Attributes Source: https://docs.selektable.com/guides/custom-store Set up the Selektable widget declaratively using HTML data attributes. This approach automatically discovers and registers elements with the `data-selektable-widget` attribute. The widget is then opened when `Selektable.open()` is called, typically from a click event. ```html