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 AGENT_API_NAME = 'onboarding';
eucera('when', 'ready', () => {
eucera('agent',AGENT_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_AGENT_ID = 'onboarding';
const SUPPORT_AGENT_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 agentID = isOnboardingFeatureEnabled ? ONBOARDING_AGENT_ID : SUPPORT_AGENT_ID;
eucera('agent',agentID, 'show');
});