Skip to main content
Initialize virtual.fit before loading the hosted script. The queue preserves commands until the loader is ready.

Complete example

Initialization fields

FieldTypeDefaultDescription
siteKeystringRequiredPublic key shown in virtual.fit.
mountCSS selector or Element.bitstudio-product-media-stageMain product media host.
overlayPositionstringtop-righttop-right, top-left, bottom-right, or bottom-left.
productobjectURL-resolvedOptional explicit product context.
customerobjectAnonymousCurrent customer id and optional email.
authobjectAnonymous visibleLogin visibility and destination.
labelsobjectEnglish defaultsShopper-facing labels and messages.
termsobjectDefault termsSummary, full terms, and email controls.
languagestringenLanguage identifier for terms configuration.
overlayTargetSelectorstringRuntime defaultAdvanced gallery host override.
overlayImageSelectorstringimgImage inside the overlay target.
gallerySelectorstringEmptyAdvanced result-gallery selector.
thumbnailSelectorstringEmptyAdvanced 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.