Ecommerce Integration Guide

This guide walks you through wiring the Fitit ecommerce surface — size finder, size table and virtual try-on — into your online store.

New to Fitit? Start with What is Fitit? for a 30-second overview of the ecosystem.

Integrating Fitit into your website is simple. Just follow these four steps:

  1. Add the script to the end of your page's <body>
  2. Add the buttons to your product detail pages
  3. Tag your product detail page elements with CSS classes and data attributes so Fitit can read the product info
  4. Configure Google Tag Manager and the dataLayer for ecommerce event tracking

Why the ft-hidden Class Is Required

The ft-hidden class is used to initially hide the buttons when the page loads. This is important because:

  1. When your page loads, Fitit makes a request to our database to check if the current product exists in our system
  2. If the product is available in our database, the buttons will automatically become visible
  3. If the product is not available, the buttons will remain hidden

This prevents showing size options for products that aren't integrated with Fitit. The system automatically handles this visibility toggle, but the ft-hidden class must be included for this functionality to work properly.

1. Add the Script

Copy and paste this code at the end of your <body> section:

HTML

<div id="fitit-app"></div>

<script defer type="text/javascript">
    window.fitit = {
      storeId: '<YOUR STORE_ID KEY>', // Replace with your actual store ID
      storeMode: 'MPA'  // Use 'SPA' if your site is a Single Page Application
    };

    let script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = 'https://cdn.fitit.ai/prod/latest/js/main.min.js';
    script.id = 'fitit-script'
    document.body.appendChild(script);

    window.addEventListener('fititReady', () => {
      console.log('Fitit READY');
    });
</script>

To get your STORE_ID KEY, contact our team at integrations@fitit.ai or through support.

2. Add the Buttons

Add these buttons to your product detail pages:

Size Finder Button

HTML

<button id="fitit-button" onclick="window.fitit.login()" class="ft-hidden" fitit-button-text="Find My Size">Find My Size</button>

Size Table Button

HTML

<button id="fitit-size-table-button" onclick="window.fitit.openSizeTable()" class="ft-hidden">Size Table</button>

Virtual Try-On Button

HTML

<button id="fitit-tryon-button" onclick="window.fitit.openTryOn()" class="ft-hidden">Try On</button>

3. Add Data Attributes and CSS Classes

To ensure Fitit works optimally with your product pages, add these CSS classes and data attributes to the corresponding elements on your product detail pages:

Product Detail Page Example

Here's how a properly integrated product page should look. Notice the numbered elements that correspond to the required CSS classes and data attributes:

Product Detail Page with numbered areas showing where to add CSS classes and data attributes for product information

CSS Classes and Data Attributes to Add

Apply these CSS classes and data attributes to the corresponding elements on your product detail pages. Each element needs both the CSS class and the data attribute:

  1. Product Images Container

    • CSS Class: fitit-images
    • Data Attribute: data-fitit="images"
    • Example: <div class="fitit-images" data-fitit="images">...</div>
  2. Product Title Element

    • CSS Class: fitit-title
    • Data Attribute: data-fitit="title"
    • Example: <h1 class="fitit-title" data-fitit="title">...</h1>
  3. Product SKU Element

    • CSS Class: fitit-sku
    • Data Attribute: data-fitit="sku"
    • Example: <span class="fitit-sku" data-fitit="sku">...</span>
  4. Product Type Element

    • CSS Class: fitit-product-type
    • Data Attribute: data-fitit="product-type"
    • Example: <div class="fitit-product-type" data-fitit="product-type">...</div>
  5. Product Brand Element

    • CSS Class: fitit-brand
    • Data Attribute: data-fitit="brand"
    • Example: <span class="fitit-brand" data-fitit="brand">...</span>
  6. Product Price Element

    • CSS Class: fitit-price
    • Data Attribute: data-fitit="price"
    • Example: <div class="fitit-price" data-fitit="price">...</div>
  7. Product Description Container

    • CSS Class: fitit-description
    • Data Attribute: data-fitit="description"
    • Example: <div class="fitit-description" data-fitit="description">...</div>
  8. Product Colors Element

    • CSS Class: fitit-colors
    • Data Attribute: data-fitit="colors"
    • Example: <div class="fitit-colors" data-fitit="colors">...</div>
  9. Size Selector Container

    • CSS Class: fitit-sizes
    • Data Attribute: data-fitit="sizes"
    • Example: <div class="fitit-sizes" data-fitit="sizes">...</div>

Styling the Buttons

Pick a preset that matches your store and click Copy Code to grab the ready-to-paste HTML for the Find My Size and Size Table buttons. The Try-On button uses your site's CSS the same way — you can apply any of these styles to it as well.

Elegant Black Style

High-contrast, uppercase, premium feel.

Fitit Branded Style (with Logo)

Dark CTA with the Fitit mark inline.

Minimalist Icon Style (Plain)

No background. Pure icon + text — for editorial layouts.

Customizing the Widget from the Admin Panel

Many of the visual settings used inside the Fitit widget (the modal that opens on top of your site) are controlled remotely from the Fitit admin panel — you don't have to redeploy your site to change them.

Sign in to app.fitit.ai and go to Settings → Script to configure:

SettingWhat it controls
Script logoThe logo shown inside the Fitit widget header.
Fitit button textDefault text/label used by the #fitit-button (e.g. "Saber mi talle", "Find My Size"). Can be overridden per-button with the fitit-button-text attribute.
Table descriptionThe description shown above the Size Table view.
Primary colorMain brand color used for buttons and accents inside the widget. Maps to the --ft-color-primary CSS variable.
Secondary colorAccent color for subtle elements inside the widget. Maps to --ft-color-secondary.
Border radiusBorder rounding for buttons and cards inside the widget. Maps to the --ft-border-radius* variables.
Display fontFont used for headings and prominent text inside the widget (--ft-font-display).
Body fontFont used for body copy inside the widget (--ft-font-body).
Font URLsGoogle Fonts (or compatible) stylesheet links loaded automatically so your chosen fonts are available inside the widget.

Changes saved in the admin panel are picked up on the next page load — no code change is required.

Advanced: Injecting Custom CSS Inside the Shadow DOM

Because the Fitit widget renders inside a Shadow DOM, CSS from your site does not reach the widget. The admin panel covers the most common theming needs (colors, fonts, radius, logo, button text), but if you need finer-grained control — for example replacing an asset, tweaking a specific element, or applying brand-specific overrides — you can inject your own stylesheet directly into the shadow root.

The pattern is:

  1. Wait until #fitit-app exists and has a shadowRoot attached.
  2. Append a <style> tag with your custom CSS to the shadow root.
  3. Use an id on the <style> tag so the helper doesn't re-inject it on every tick (and you can update/remove it later).

Custom Shadow DOM styles

<script>
  function injectFititStyles(css) {
    const interval = setInterval(() => {
      const el = document.querySelector("#fitit-app");

      if (!el || !el.shadowRoot) return;

      if (el.shadowRoot.querySelector("#fitit-custom-style")) {
        clearInterval(interval);
        return;
      }

      const style = document.createElement("style");
      style.id = "fitit-custom-style";
      style.innerHTML = css;

      el.shadowRoot.appendChild(style);

      clearInterval(interval);
    }, 100);
  }
</script>

<script>
  injectFititStyles(`
    #fitit-upload-guide-image-t-shirt {
      background-image: url('/img/remera-elburgues.jpeg') !important;
    }
  `);
</script>

4. Google Tag Manager Requirements

Before connecting Fitit through Google Tag Manager, make sure the store meets the following requirements.

1. Google Tag Manager must be installed and active across the ecommerce flow

The store must have an active Google Tag Manager container installed and published in production.

The GTM container must be loaded on all pages or screens where Fitit needs to track ecommerce behavior, including:

  • Product detail pages
  • Add-to-cart interactions
  • Cart / checkout flow, when applicable
  • Order confirmation / thank-you page

The container should be visible in the browser network requests as:

https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX

Please note that Google tag IDs such as GT-XXXXXXX, G-XXXXXXX or AW-XXXXXXX are not the same as a Google Tag Manager container.

Fitit's GTM integration requires a real GTM container, identified by a public ID in this format:

GTM-XXXXXXX

2. Ecommerce events must be pushed to the dataLayer

Fitit reads ecommerce events from the store's dataLayer.

The store should push events using:

dataLayer push

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "event_name"
});

Recommended standard ecommerce event names are:

  • view_item
  • add_to_cart
  • purchase

If the store uses custom event names, they can be mapped during the Fitit setup.

For example, if the store sends:

Custom purchase event

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "orderPlaced",
  ecommerce: {
    transaction_id: "T_12345",
    value: 72.05,
    currency: "USD",
    items: [
      {
        item_id: "SKU_12345",
        item_name: "Product name",
        price: 72.05,
        quantity: 1
      }
    ]
  }
});

then the Fitit event mapping should be configured as:

purchase → orderPlaced

The mapped event name must match exactly the value sent in the event field.

3. Standard purchase dataLayer example

For purchase tracking, the recommended dataLayer structure should follow the standard Google Analytics ecommerce format:

Standard purchase event

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "T_12345",
    affiliation: "Online Store",
    value: 72.05,
    tax: 3.60,
    shipping: 5.99,
    currency: "USD",
    coupon: "SUMMER_SALE",
    items: [
      {
        item_id: "SKU_12345",
        item_name: "Stan and Friends Tee",
        item_brand: "Google",
        item_category: "Apparel",
        item_category2: "Adult",
        item_category3: "Shirts",
        item_variant: "Green",
        price: 29.99,
        quantity: 1
      },
      {
        item_id: "SKU_12346",
        item_name: "Google Grey Women's Tee",
        item_brand: "Google",
        item_category: "Apparel",
        item_category2: "Adult",
        item_category3: "Shirts",
        item_variant: "Grey",
        price: 42.06,
        quantity: 1
      }
    ]
  }
});

Minimum required fields for purchase tracking:

  • event
  • ecommerce.transaction_id
  • ecommerce.value
  • ecommerce.currency
  • ecommerce.items
  • ecommerce.items.item_id
  • ecommerce.items.item_name
  • ecommerce.items.price
  • ecommerce.items.quantity

4. Custom event mapping

If the ecommerce platform does not use the standard GA4 event names, configure the custom event names in the Event Mapping section of the Fitit admin panel.

Example:

Fitit eventStore dataLayer event
view_itemview_item
add_to_cartadd_to_cart
purchaseorderPlaced

The value must match the exact event value pushed to the dataLayer.

For example, if the store sends:

Store purchase payload

window.dataLayer.push({
  event: "orderPlaced",
  ecommerce: {
    transaction_id: "123456",
    value: 800,
    currency: "UYU",
    items: [
      {
        item_id: "SKU_12345",
        item_name: "Product name",
        price: 800,
        quantity: 1
      }
    ]
  }
});

the purchase mapping should be:

purchase → orderPlaced

Not:

purchase → purchase

because the store is not pushing an event called purchase — it is pushing an event called orderPlaced.

Was this page helpful?