Universal Installation

This guide covers installing TrialClouds Virtual Try-On on any website, including WooCommerce, WordPress, Magento, custom platforms, or static HTML sites. The installation involves adding a script tag and button HTML to your website.

Best for: Non-Shopify platforms, custom websites, WooCommerce stores Time required: 15-20 minutes Skill level: Basic HTML knowledge helpful Alternative: For Shopify stores, see Shopify App Installation

1

Get your Site ID

You will find your Site ID in the TrialClouds dashboard and use it in the embed script.

2

Add the embed script

Add the TrialClouds script to every page where you want try-on functionality.

3

Add Try-On buttons

Add the trigger button HTML to product pages so the widget opens with the product data.


Step 1: Get Your Site ID

1.1 Login to Dashboard

  1. Login with your account credentials

  2. Complete onboarding if you haven't already

1.2 Find Your Site ID

If you've completed onboarding:

  • Navigate to Sites section in left sidebar

  • Find your site in the list

  • Your Site ID is displayed under the site name

  • Click the copy icon to copy it

If you haven't set up a site yet:

  • Click "Add Site" or follow the onboarding flow

  • Enter your domain (e.g., www.yourstore.com)

  • Complete the setup wizard

  • Your Site ID will be generated

Site ID Format: A long alphanumeric string like cmkozmnbi00012euxrl81rx69

circle-info

Tip: Keep your Site ID handy – you'll need it for the embed script.

[Screenshot Placeholder: Dashboard Sites page showing site card with Site ID highlighted and copy button]


Step 2: Add the Embed Script

The embed script loads the TrialClouds widget on your website. It must be added to every page where you want the try-on functionality to work.

2.1 Get the Script Code

From your dashboard:

  1. Click on your site

  2. Find the "Embed Script" section

  3. Click "Copy to Clipboard"

The script looks like this:

Replace YOUR_SITE_ID with your actual Site ID if copying manually.

2.2 Where to Place the Script

Recommended Placement: Just before the closing </body> tag

Why? This ensures the page content loads first, then the widget script loads asynchronously without blocking page render.

Alternative: In the <head> section with defer attribute (advanced)

2.3 Platform-Specific Instructions

WordPress / WooCommerce

Method 1: Theme Footer File (Recommended)

  1. Go to Appearance β†’ Theme Editor

  2. Find and open footer.php (right sidebar, under Theme Files)

  3. Scroll to find the closing </body> tag

  4. Paste the script just before </body>

  5. Click "Update File" to save

  6. The script now loads on all pages

⚠️ Warning: Changes may be lost on theme updates. Consider using a child theme.

Method 2: Plugin (Safer for Theme Updates)

  1. Install a plugin like "Insert Headers and Footers" or "Code Snippets"

  2. Go to plugin settings

  3. Paste the script in the "Footer" section

  4. Save changes

  5. The plugin injects the script automatically

Method 3: Custom Hook (Advanced)


Custom HTML Website

  1. Open your main layout/template file (e.g., index.html, layout.html, _layout.html)

  2. Find the closing </body> tag

  3. Paste the script just before </body>

  4. Save the file

  5. Upload to your server if needed

Example:


Webflow

  1. Go to Project Settings (top left gear icon)

  2. Navigate to Custom Code tab

  3. Scroll to Footer Code section

  4. Paste the TrialClouds script

  5. Click "Save Changes"

  6. Publish your site for changes to take effect


Squarespace

  1. Go to Settings β†’ Advanced β†’ Code Injection

  2. Find the Footer section

  3. Paste the TrialClouds script

  4. Click "Save"

  5. The script will load on all pages


Wix

  1. Go to Settings β†’ Custom Code (under Advanced)

  2. Click "+ Add Custom Code"

  3. Paste the TrialClouds script

  4. Set placement to "Body - end"

  5. Apply to "All Pages" or select specific pages

  6. Publish your site


Magento 2

  1. In Magento Admin, go to Content β†’ Configuration

  2. Select your store view and click "Edit"

  3. Expand "HTML Head" section

  4. Paste the script in "Scripts and Style Sheets"

  5. Save configuration

  6. Clear cache

Alternatively, edit your theme's footer.phtml template file.


React / Vue / Angular (SPA)

For single-page applications, add the script to your main index.html file:

React (public/index.html):

Dynamic Button Detection: The widget automatically detects buttons added dynamically using MutationObserver, so it works seamlessly with SPAs.


2.4 Verify Script Installation

  1. Open your website in a browser

  2. Press F12 to open Developer Tools

  3. Go to Console tab

  4. Type: window.TrialClouds_API

  5. Press Enter

Expected Result: Should display an object (not undefined)

If you see an object, the script is loaded successfully! βœ…

If you see undefined, the script isn't loading. Check:

  • Site ID is correct

  • No JavaScript errors in Console

  • Script URL is accessible (check Network tab)

[Screenshot Placeholder: Browser console showing window.TrialClouds_API object]


Step 3: Add Try-On Buttons

Now that the widget script is loaded, you need to add "Try On" buttons to your product pages.

3.1 Button HTML Template

Here's the complete button code with all attributes:

3.2 Required Attributes

These attributes MUST be present for the widget to work:

Attribute
Description
Example

class

Must be trialclouds-trial-widget-trigger-button

(don't change)

data-product-id

Unique product identifier

"SKU123" or "789"

data-product-name

Product title/name

"Blue Cotton Shirt"

data-images

JSON array of image URLs

'["url1.jpg","url2.jpg"]'

data-link

Product page URL

"https://store.com/product"

3.3 Optional Attributes

These enhance functionality but aren't required:

Attribute
Description
Example

data-brand

Brand/vendor name

"Nike"

data-price

Original price (number)

"99.99"

data-sale-price

Discounted price

"79.99"

data-currency

Currency code

"USD", "EUR", "GBP"

data-source

Pre-loaded customer photo URL

"https://..."

data-user-id

Customer ID (for analytics)

"customer_456"

data-user-name

Customer name (pre-fills widget)

"John Doe"

data-user-email

Customer email

3.4 Important Notes

Image URLs:

  • Must be publicly accessible (not localhost)

  • Use HTTPS (not HTTP)

  • Format as JSON array: '["url1","url2"]'

  • URLs should point to model photos (person wearing product)

Button Text:

  • Customize as needed: "Try It On", "Virtual Try-On", "See On You"

  • Emojis work great: πŸ‘—, πŸ‘•, πŸ‘”, ✨

Class Name:

  • The class trialclouds-trial-widget-trigger-button is REQUIRED

  • Don't remove or rename it

  • You can add additional classes for styling


3.5 WooCommerce Implementation

For WooCommerce, you'll want to dynamically populate product data.

Method 1: Template File Edit

  1. Edit your theme's single-product.php or content-single-product.php

  2. Find a good location (after product image or near Add to Cart)

  3. Add this code:

Method 2: Using Hook (Recommended)

Add to your theme's functions.php:


3.6 Custom Styling

The button inherits your site's default styles, but you can customize it:

Add this CSS to your theme's stylesheet or in a <style> tag.


Step 4: Test Your Installation

4.1 Basic Test

  1. Open a product page where you added the button

  2. Look for the "Try On" button

  3. Click the button

  4. The TrialClouds widget should open in an overlay

βœ… Success: If the widget opens, your installation is working.

4.2 Complete Test

  1. In the widget, click "Upload Photo"

  2. Select a test image with a clear face

  3. Wait for AI processing (20-30 seconds)

  4. View the try-on result

  5. Test download button (if enabled)

4.3 Cross-Browser Testing

Test in multiple browsers:

  • Chrome

  • Firefox

  • Safari

  • Edge

  • Mobile browsers (iOS Safari, Chrome on Android)

4.4 Mobile Testing

Test on actual devices:

  • Open product page on mobile

  • Button should be visible and tappable

  • Widget should display properly

  • Upload from gallery or camera should work


Troubleshooting

chevron-rightWidget Doesn't Openhashtag

Check:

  • βœ“ Button has class trialclouds-trial-widget-trigger-button

  • βœ“ Embed script is loaded (check window.TrialClouds_API in console)

  • βœ“ No JavaScript errors in browser console

  • βœ“ Site ID matches dashboard exactly

  • βœ“ Domain in dashboard matches your actual domain

chevron-rightImages Not Showinghashtag

Check:

  • βœ“ Image URLs are publicly accessible (not localhost)

  • βœ“ URLs use HTTPS (not HTTP)

  • βœ“ data-images is valid JSON: '["url1","url2"]'

  • βœ“ No CORS issues (check Network tab in DevTools)

chevron-rightButton Looks Wronghashtag

Check:

  • βœ“ CSS conflicts with other styles

  • βœ“ Inspect element to see applied styles

  • βœ“ Add !important to your custom styles if needed

  • βœ“ Check for CSS specificity issues

Need More Help?


Next Steps

Installation complete! Now optimize your setup:

  1. Customize Appearance: Manage Sites

  2. Optimize Button: Button Customization

  3. Improve Placement: Button Placement

  4. Monitor Analytics: Dashboardarrow-up-right


Advanced Topics

Multiple Buttons Per Page

You can have multiple try-on buttons on the same page (e.g., for related products):

Each button will open the widget with its respective product data.

Pre-filling Customer Data

If you have logged-in customers, pre-fill their data for a faster experience:

Security: Never expose sensitive data. Only use publicly available customer info.

Dynamic Buttons (JavaScript)

For SPAs or dynamically loaded products:


Need help? Contact us at [email protected]envelope

Last updated