Dressipi.js
    • 1 Minute to read
    • Dark
      Light

    Dressipi.js

    • Dark
      Light

    Article summary

    We provide a client-side javascript SDK to aid integration

    We provide Dressipi.js, our client-side javascript SDK, which can be used to show Dressipi-hosted widgets, send client-side tracking, and show the Style Hub. You paste the snippet below into your site or tag manager, make function calls to the library, and then we'll handle API calls, widget interaction tracking, and embedding content.

    Adding the SDK to your site

    Paste this somewhere near the top of the page - it must be defined before calling any of the SDK functions (e.g. Dressipi('widget', ...)).

    The snippet of code below contains https://dressipi.example.com - this must be replaced with the host name that we provide you during your onboarding process.

    <script>
      (function(D, r, e, s, S, i, p, I) {
        D['DressipiLoaderObjectName'] = i;
        D[i] = D[i] || function() {
          (D[i].q = D[i].q || []).push(arguments);
        };
        D[i].l = 1 * new Date();
        D[i]("config", "set", "host", S);
        p = r.createElement(e);
        I = r.getElementsByTagName(e)[0];
        p.async = 1;
        p.src = s;
        I.parentNode.insertBefore(p, I);
      })(
        window,
        document,
        'script',
        'https://static.dressipi.com/dressipi.v3.js',
        'https://dressipi.example.com',
        'Dressipi'
      );
    
      // The namespace_id UUID will be provided by Dressipi
      // this must be set before any other calls to Dressipi
      Dressipi("config", "set", "namespace_id", "00000000-0000-0000-0000-000000000000");
    
      // this must be called on each page view - single page apps should call this for each new route.
      Dressipi('track', 'pageView');
    
      // you may then request recommendations as follows:
      Dressipi("related", "outfits", {
        item_id: "YOUR_PRODUCT_CODE_OR_SKU",
        placement_id: "A_UUID_PROVIDED_BY_DRESSIPI", // this represents a unique place on the page where recommendations show
        onSuccess: (data) => {
        },
      });
    </script>

    Our different builds

    You may opt to use one of our alternative SDKs that are optmised for the features you require. Simply replace the similar url in the snippet with the alternative below.

    Path

    Gzipped Size

    Features

    https://static.dressipi.com/dressipi.v3.js

    ~27kb

    ✅ Tracking

    By arrangement:
    ✅ Dressipi-hosted Widgets
    ❌ Style Hub

    https://static.dressipi.com/dressipi.hub.v3.js

    ~37kb

    ✅ Tracking

    By arrangement:
    ✅ Dressipi-hosted Widgets
    ✅ Style Hub


    Was this article helpful?

    ESC

    AI Assistant, facilitating knowledge discovery through conversational intelligence