Web SDK¶
The Aiuta Web SDK provides a virtual try-on solution for your fashion e-commerce platform using Aiuta Virtual Try On API.
-
Expolore UI Pages, Sequence diagrams, Resources and Analytics
-
Learn how to setup Authentification, Configure UI and manage Features
Limited support
The Web SDK is currently under active development and only supports a small subset of configuration and styling options. Read more here.
Quick Start¶
<script src="https://static.aiuta.com/sdk/1.0.5/index.umd.js"></script>
<script>
const aiuta = new Aiuta({
auth: { // (1)!
subscriptionId: 'your_subscription_id', // (2)!
getJwt: async (params) => {
return 'JWT_from_your_backend' // (3)!
},
},
userInterface: { // (4)!
theme: {
customCssUrl: 'https://your-domain.com/aiuta-custom.css', // (5)!
},
},
analytics: { // (6)!
handler: {
onAnalyticsEvent: (event) => {
console.log('Aiuta Event:', event) // (7)!
},
},
},
})
aiuta.tryOn('your_product_id') // (8)!
</script>
-
auth required to authenticate Aiuta SDK to use API with your credentials. Supported authentication methods are
ApiKeyorJwt+subscriptionId. -
Should be provided for the SDK to make unsecured requests related to your account.
Please see Obtaining credentials for instructions on how to get your
subscriptionId -
The implementation of this method should securely generate the JWT on the server side and subsequently return it to the SDK.
Please see
getJwtsection of JwtAuth for more information on how it works -
userInterface optional customization of user interface.
-
Optional URL to the CSS file with styles configuration for the Web SDK App.
CORS
The CSS file provided by
customCssUrlmust be accessible for loading by a cross-origin iframe hosted onstatic.aiuta.comThis means the server hosting your CSS must send appropriate CORS headers (e.g.,
Access-Control-Allow-Origin: https://static.aiuta.com) to allow the SDK iframe to fetch and apply your custom styles.Please see Custom CSS for styling options and Localization for text customization
-
Optional configuration to handle analytics events generated by the SDK.
-
Callback function that processes analytics events generated by the SDK, allowing integration with external analytics services or custom event handling.
-
Open SDK UI to start try on flow with selected product identifier.
Please note that you should obtain information about the availability of the virtual try-on feature for each of your products from your backend, as the SDK does not receive information about product availability and will attempt to launch a virtual try-on with any product you provide, which may result in an error if that product has not been trained by Aiuta.