๐Ÿ”ฌ
MAZING World
  • ๐Ÿ‘‹Welcome to MAZING World
  • Overview
    • โœจOur Products
  • Product Guides
    • ๐ŸงŠCreate 3D Model with AI
    • ๐Ÿ“ชUpload Your Own 3D Model
    • ๐Ÿ“ŽUsing a Template
      • ๐Ÿ–ผ๏ธAugmented Reality Art
      • ๐ŸชกVirtual Carpet
      • ๐Ÿ—ƒ๏ธBulk Uploader
    • ๐Ÿ˜ปGlass Try-On
    • ๐ŸงฎCreate 3D Configurator
    • ๐Ÿ“ฆAI Product Visuals
      • ๐Ÿ“ฝ๏ธCreate Silo Renderings
      • ๐Ÿ‘”Create Lifestyle Renderings
      • ๐ŸŽž๏ธCreate AI 3D Videos
    • ๐ŸคฏPremium Features
      • ๐Ÿ–ฅ๏ธTexture Change
      • ๐Ÿ”ญUsing Hotspots
      • ๐ŸŽฅViewer Settings
      • ๐Ÿ‘ฅUsing Shadows
      • ๐Ÿ’ŽDiamond Material
      • ๐Ÿ”ฅFire Particles
      • ๐Ÿ—ฃ๏ธCall To Action
      • ๐ŸŽฌVideo Texture
      • ๐ŸŽบUsing Sound
      • ๐ŸŽž๏ธGif Texture
      • ๐Ÿ’ฑAdvanced Editor
      • ๐Ÿ“Scale Model
      • ๐Ÿ“ทBlock Camera Views
  • INTEGRATION
    • ๐Ÿ˜ŽIFrame On-site
    • ๐Ÿ’ปScript Integration
    • Shopware Plugin
    • ๐ŸŒWordpress
      • ๐ŸคฉWP Script Integration
      • ๐Ÿ”—WP Shortcode Integration
    • ๐ŸงฉShopify
      • Script Integration
    • ๐Ÿ’ซVariant Integration
    • ๐Ÿ“ŠA/B Test
    • Additional Notes
      • Content-Security Policy
      • iFrame Flags & Setup
  • Project Management
    • ๐Ÿ“Model Feedback
  • ๐Ÿ“คSharepoint
  • ๐Ÿ’ธBilling and Invoices
  • Use Cases
    • ๐ŸงFor Designers
    • ๐ŸŽจFor Artists
    • ๐Ÿ“กFor Agencies
    • ๐Ÿ›๏ธFor eCommerce
  • APIs
    • ๐Ÿ‘จโ€๐Ÿ’ปAugmented Reality API
  • FAQ
    • โ™ป๏ธCan't Log into Mazing World?
    • ๐Ÿ“จRequest Support
Powered by GitBook
On this page
  • Getting Started with A/B Testing
  • What's happening?
  1. INTEGRATION

A/B Test

See the result!

Getting Started with A/B Testing

You can easily set up A/B testing and measure conversion rates by using our mazingSetAB() method.

Simply add the following code block at the beginning of your integration file:

await waitForMazingFunction; // Wait till mazing cdn method is available
// Write a method which waits for certain elements and replace
// the selector with you own add to cart button selector
await waitForElement('.buy-buttons button[type="submit"]');

mazingSetAB({
    enabled: true, // Set this boolean to "false" if you want to deactivate the A/B Test
    addToCartListeners: (callback) => {

        // Replace selector with your actual add to cart button selector
        document.querySelector('.buy-buttons button[type="submit"]').addEventListener('click', () => {
            console.log('MAZING: addToCartClicked A/B');
            callback();
        });

        return true;
    }
});

What's happening?

await waitForMazingFunction

This method waits until the Mazing function from the CDN is fully loaded and available. Hereโ€™s an example of how you can use it:

const waitForMazingFunction = new Promise((resolve) => {
    const interval = 50;
    const checkInterval = setInterval(() => {
        if (typeof mazing === 'function') {
            clearInterval(checkInterval);
            resolve();
        }
    }, interval);
});

await waitForElement()

This method waits until a specific element (e.g., the "Add to Cart" button) is fully loaded and available in the DOM. You pass a CSS selector as an argument. Hereโ€™s an example:

const waitForElement = (selector, timeout = 55000) => {
    return new Promise((resolve) => {
        const interval = 50;
        let elapsedTime = 0;

        const checkInterval = setInterval(() => {
            const element = document.querySelector(selector);
            if (element) {
                clearInterval(checkInterval);
                resolve(element);
            } else if ((elapsedTime += interval) >= timeout) {
                clearInterval(checkInterval);
                resolve();
            }
        }, interval);
    });
};

mazingSetAB()

Each time a customer visits your shop, they will be randomly assigned to either Group A (with the Mazing script integration) or Group B (without the integration). We track how many users click the โ€œAdd to Cartโ€ button in each group and compare the results to calculate the conversion rate.

If you're interested in accessing the results, feel free to contact the Mazing team!

Don't forget to replace the add to cart selector with your actual selector!

PreviousVariant IntegrationNextAdditional Notes

Last updated 1 day ago

It's important to add this before you get the iframe source! See ->

๐Ÿ“Š
Script Integration Example