Calling the SDK and displaying copilot when ready


   const TAG_KEY = "YOUR-PRODUCT-TAG-KEY-HERE";
    (function (w, d, u, n, k, c) {w[n]=w[n]||function () {(w[n].q = w[n].q || []).push(arguments);};
        w[n].k = k;w[n].c = c;var s = d.createElement('script');s.async = true;s.src = u + '?k=' + k;
        var h = d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s, h);
})(window, document, 'https://script.eucerahive.io/web/sdk/eucera.js', 'eucera', TAG_KEY);

    //listen to Eucera ready and call copilot show
    const COPILOT_API_NAME = 'onboarding';
    eucera('when', 'ready', () => {
        eucera('copilot',COPILOT_API_NAME, 'show');
    });

Advanced copilot setup using feature flag


    const TAG_KEY = "YOUR-PRODUCT-TAG-KEY-HERE";
    (function (w, d, u, n, k, c) {w[n]=w[n]||function () {(w[n].q = w[n].q || []).push(arguments);};
        w[n].k = k;w[n].c = c;var s = d.createElement('script');s.async = true;s.src = u + '?k=' + k;
        var h = d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s, h);
    })(window, document, 'https://script.eucerahive.io/web/sdk/eucera.js', 'eucera', TAG_KEY);

    // copilot api names
    const ONBOARDING_COPILOT_ID = 'onboarding';
    const SUPPORT_COPILOT_ID = 'support';
    //listen to Eucera ready and execute show for specific copilot based on the
    //feature flag value
    eucera('when', 'ready', () => {
        const isOnboardingFeatureEnabled = eucera.getVariant(COPILOT_FEATURE_FLAG, true);
        const copilotID = isOnboardingFeatureEnabled ? ONBOARDING_COPILOT_ID : SUPPORT_COPILOT_ID;
        eucera('copilot',copilotID, 'show');
    });