Direct Code Integration¶
Use this method if you want to integrate widgets directly into any website or have more control over the implementation.
Prerequisites¶
- Valid Glance AI Store ID and Catalog ID
- Active Glance AI account status
Implementation¶
Copy the code snippet below and customize the configuration:
<div id="glance-widget-container" class="widget-shimmer"></div>
<style>
#glance-widget-container {
display: block;
}
/* Shimmer effect */
.widget-shimmer {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 8px;
height: 100%;
}
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
</style>
<script>
(function () {
try {
// ===== CONFIGURATION - CUSTOMIZE THESE VALUES =====
const CONFIG = {
// Required: Your Glance AI credentials
partnerId: "YOUR_STORE_ID_HERE",
catalogId: "YOUR_CATALOG_ID_HERE",
// Required: Widget configuration
widgetType: "try_on_banner", // Options: 'chat', 'try_on_banner', 'try_on_button'
// Required: Page information
pageType: "PDP", // Options: 'PDP' (Product), 'PLP' (Collection), 'HOME', 'OTHER'
pageIdentifier: "YOUR_PRODUCT_OR_PAGE_ID",
storeHandle: "your-store-handle",
// Optional: Widget customization
brandLogo: "",
title: "How will this dress look on me?",
subtitle: "Upload your photo and virtually try it on",
backgroundColor: "linear-gradient(97.16deg, rgba(157, 53, 255, 0.3) 35.24%, rgba(1, 25, 244, 0.3) 67.13%, rgba(58, 158, 174, 0.3) 99.02%), linear-gradient(0deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8))",
// Optional: Button positioning (for try_on_button type)
buttonPosition: "absolute",
buttonBottom: 20,
buttonRight: 20,
// Optional: Custom styling
customCSS: "",
// Optional: Animation settings
productIndex: 0,
animateTryOnButton: true,
};
// ===== END CONFIGURATION =====
const containerId = "glance-widget-container";
const IFRAME_ORIGIN = "https://embed.glance.com";
// ... rest of implementation
} catch (error) {
console.error("Glance AI Widget: Initialization error:", error);
}
})();
</script>