diff --git a/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js b/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js index d98b2f29b..9f765e1d9 100644 --- a/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js +++ b/packages/analytics-js-integrations/src/integrations/MicrosoftClarity/browser.js @@ -58,8 +58,10 @@ class MicrosoftClarity { } const identifyPromise = window.clarity('identify', userId, sessionId, customPageId); - if (!!identifyPromise) { // Clarity SDK is ready - identifyPromise.catch(logger.error); + if (typeof identifyPromise?.then === 'function') { // Clarity SDK is ready + identifyPromise.catch(error => { + logger.error('The "identify" promise was rejected', error); + }); } if (context?.traits) { const { traits } = context;