Initialize virtual.fit before loading the hosted script. The queue preserves commands until the loader is ready.
Complete example
Initialization fields
| Field | Type | Default | Description |
|---|
siteKey | string | Required | Public key shown in virtual.fit. |
mount | CSS selector or Element | .bitstudio-product-media-stage | Main product media host. |
overlayPosition | string | top-right | top-right, top-left, bottom-right, or bottom-left. |
product | object | URL-resolved | Optional explicit product context. |
customer | object | Anonymous | Current customer id and optional email. |
auth | object | Anonymous visible | Login visibility and destination. |
labels | object | English defaults | Shopper-facing labels and messages. |
terms | object | Default terms | Summary, full terms, and email controls. |
language | string | en | Language identifier for terms configuration. |
overlayTargetSelector | string | Runtime default | Advanced gallery host override. |
overlayImageSelector | string | img | Image inside the overlay target. |
gallerySelector | string | Empty | Advanced result-gallery selector. |
thumbnailSelector | string | Empty | Advanced thumbnail selector. |
Start with siteKey, mount, and terms. Add advanced selectors only after the basic integration works.
Product object
Provide id or handle. The loader verifies it against the synced enabled catalog before mounting.
For color or style variants, pass the selected variant’s unique synced ID. imageUrl supplies display context only; changing it does not replace the garment associated with id.
Customer and authentication
auth.loginUrl accepts a string or callback. The callback receives:
returnTo — Current absolute page URL.
product — Resolved product context, or null.
location — Current href, origin, pathname, search, and hash.
showToAnonymous controls whether a logged-out shopper can see a login call to action when your virtual.fit settings require authentication. The customer-access policy in virtual.fit remains authoritative.
Terms object
Use one source for full terms:
fullHtml — Pass full HTML directly.
fullSelector — Read innerHTML from an existing host-page element.
If neither is set, virtual.fit uses its default terms. See Styling, labels, and terms.
Single-tag installation
When a platform allows one script tag but no inline queue, use data attributes:
JavaScript initialization is preferred when values are dynamic or loginUrl needs callback logic.
Legacy aliases
Use terms for disclaimer and legal content. Use labels for interface text. Older content and ui aliases remain accepted for existing installs, but new integrations should not depend on them.