diff --git a/app/utils/Analytics.ts b/app/utils/Analytics.ts index 8b07b5032..3d260f750 100644 --- a/app/utils/Analytics.ts +++ b/app/utils/Analytics.ts @@ -14,13 +14,17 @@ export default class Analytics { metadata?: Record ) => { // GA3 - ga?.("send", "event", event, action); + if (window.ga) { + window.ga("send", "event", event, action); + } // GA4 - window.dataLayer?.push({ - event, - action, - ...metadata, - }); + if (window.dataLayer) { + window.dataLayer.push({ + event, + action, + ...metadata, + }); + } }; }