The PrintWearAI widget integrates on any web page with a single line of code.
<script src="https://printwearai.com/embed.js"
data-key="YOUR_KEY"
data-sku="JERSEY-001"></script>
Paste this snippet where you want the configurator to appear. The widget mounts an inline iframe into a container (#pwai-configurator by default, or the element you set with data-target). Copy the ready-made snippet from Tenant workspace β Integration.
data-* attributes| Attribute | Type | Default | Description |
|---|---|---|---|
data-key | string | β | Required. Your public embed key fk_β¦ (Tenant workspace β Integration). |
data-product | string | β | Product slug β opens straight on that model. If absent, the configurator opens on the product picker (category tabs + product grid). |
data-sku | string | β | External SKU. Resolved against the product's SKU / reference field via /api/resolve. |
data-autodetect | bool | true | Auto-detects the SKU from the page (Shopify, schema.org, meta). Set "false" on custom sites. |
data-target | string | #pwai-configurator | CSS selector of the container that hosts the iframe. |
data-height | number | 700 | Iframe height in px (auto-grows via resize messages). |
data-locale | string | auto | ISO language: en, fr, es, de, it. |
data-config | string | β | Reopen a previously saved configuration by its id. |
data-no-consent | bool | false | Set "true" if your site already handles cookie consent. |
The widget automatically recognizes the product in 7 cases:
data-skuwindow.PWAI_PRODUCT<meta name="pwai:sku" content="...">ShopifyAnalytics.meta.product)application/ld+json with @type: Productdata-product-id)product:retailer_item_id<div id="pwai-configurator"></div>
<script src="https://printwearai.com/embed.js"
data-key="YOUR_KEY"
data-sku="JERSEY-001"
data-target="#pwai-configurator"></script>
The configurator always mounts as an inline iframe inside the target element. To open it as a modal or on click, mount it into a container you show/hide yourself (see the cart callback below and the custom site guide).
Omit data-product/data-sku (and set data-autodetect="false") to open the configurator on its choice screen: your brand header, category tabs (per sport) and a product grid. Great for a generic βDesign yoursβ button.
On custom sites there is no automatic add-to-cart (that is built in for Shopify/WooCommerce/PrestaShop). Register your own handler with PwaiEmbed.onAddToCart():
PwaiEmbed.onAddToCart(function (m) {
// m.config_id β saved configuration id (keep it: links to production)
// m.product.name β product name
// m.product.flare_id β internal PrintWearAI id
// m.quantity β quantity
// m.sizes β { "M": 3, "L": 2, ... } size breakdown
// m.customization.thumbnail β preview image URL
// m.customization.patron_svg β production pattern SVG (raw)
// m.customization.config β full raw design config
// m.bat.zones β [{zone, color, pantone, gradient, pattern}] named zones
// m.share_token / m.export_url / m.bat_url β server-side design links
// (the design is auto-saved server-side, even for guests)
// m.sku β SKU if any
console.log('Added to cart:', m);
// β push it into your own cart flow here
});
Visitors can save a design without ordering (no account needed). Your page gets notified β perfect for lead capture and follow-up:
PwaiEmbed.onDesignSaved(function (m) {
// m.config_id β saved design id (reopen later with data-config)
// m.share_token β public token
// m.export_url β server-side JSON export (config, preview, texts, colors)
// m.bat_url β printable proof page (bon Γ tirer)
// m.thumbnail β preview image
console.log('Design saved:', m);
});
Your backend also receives the design.saved webhook with the same links, plus guest_email when provided.
The data-key key is public: it can appear in the HTML without risk. It gives no read/write access to your private data β only the right to launch a configurator linked to your tenant. For sensitive operations (order creation, reading stats), use the REST API with a secret key.