{"version":3,"file":"gtm-init-B8eFBGJF.js","sources":["../../../app/assets/entrypoints/gtm-init.js"],"sourcesContent":["window.dataLayer = window.dataLayer || [];\n\nconst trackOptimizelyEvent = (eventName) => {\n if (\n window.optimizely?.initialized &&\n [\n 'Clicked Nav Give Button - Scrolled to Donate Form',\n 'Clicked Nav Give Button - Opened Donate Form Modal',\n 'Clicked Nav Give Button - Redirected to Donate Page',\n ].includes(eventName)\n ) {\n window.optimizely.push({\n eventName: eventName,\n tags: {},\n type: 'event',\n });\n }\n};\n\nwindow.track_event = (eventName, properties = {}) => {\n window.dataLayer.push({\n event: eventName,\n ...properties,\n });\n\n trackOptimizelyEvent(eventName);\n};\n\nconst dataUsedOnGTMInit = () => {\n const optimizelyRedirectInfo = window.optimizely\n ?.get?.('state')\n ?.getRedirectInfo?.();\n const preRedirectReferrerOrCurrentReferrer = optimizelyRedirectInfo\n ? optimizelyRedirectInfo.referrer\n : document.referrer;\n\n return {\n donation_interface: !!window.StripeTerminal ? 'lab_kiosk' : null,\n gpc_enabled: !!navigator.globalPrivacyControl,\n real_referrer: preRedirectReferrerOrCurrentReferrer,\n redirected_by_optimizely: !!optimizelyRedirectInfo,\n user_id: window.userId || undefined,\n };\n};\n\nwindow.dataLayer.push(dataUsedOnGTMInit());\nwindow.dataLayer.push({ event: 'gtm.js', 'gtm.start': new Date().getTime() });\n\nconst scriptTarget = document.getElementsByTagName('script')[0];\nconst script = document.createElement('script');\nscript.async = true;\nscript.src = window.gtmScriptUrl;\nscriptTarget.parentNode.insertBefore(script, scriptTarget);\n"],"names":["trackOptimizelyEvent","eventName","_a","properties","dataUsedOnGTMInit","_b","_c","_d","optimizelyRedirectInfo","preRedirectReferrerOrCurrentReferrer","scriptTarget","script"],"mappings":"AAAA,OAAO,UAAY,OAAO,WAAa,CAAE,EAEzC,MAAMA,EAAwBC,GAAc,CAF5C,IAAAC,GAIIA,EAAA,OAAO,aAAP,MAAAA,EAAmB,aACnB,CACE,oDACA,qDACA,qDACD,EAAC,SAASD,CAAS,GAEpB,OAAO,WAAW,KAAK,CACrB,UAAWA,EACX,KAAM,CAAE,EACR,KAAM,OACZ,CAAK,CAEL,EAEA,OAAO,YAAc,CAACA,EAAWE,EAAa,CAAA,IAAO,CACnD,OAAO,UAAU,KAAK,CACpB,MAAOF,EACP,GAAGE,CACP,CAAG,EAEDH,EAAqBC,CAAS,CAChC,EAEA,MAAMG,EAAoB,IAAM,CA5BhC,IAAAF,EAAAG,EAAAC,EAAAC,EA6BE,MAAMC,GAAyBD,GAAAD,GAAAD,GAAAH,EAAA,OAAO,aAAP,YAAAA,EAC3B,MAD2B,YAAAG,EAAA,KAAAH,EACrB,WADqB,YAAAI,EAE3B,kBAF2B,YAAAC,EAAA,KAAAD,GAGzBG,EAAuCD,EACzCA,EAAuB,SACvB,SAAS,SAEb,MAAO,CACL,mBAAsB,OAAO,eAAiB,YAAc,KAC5D,YAAa,CAAC,CAAC,UAAU,qBACzB,cAAeC,EACf,yBAA0B,CAAC,CAACD,EAC5B,QAAS,OAAO,QAAU,MAC3B,CACH,EAEA,OAAO,UAAU,KAAKJ,GAAmB,EACzC,OAAO,UAAU,KAAK,CAAE,MAAO,SAAU,YAAa,IAAI,KAAI,EAAG,QAAO,EAAI,EAE5E,MAAMM,EAAe,SAAS,qBAAqB,QAAQ,EAAE,CAAC,EACxDC,EAAS,SAAS,cAAc,QAAQ,EAC9CA,EAAO,MAAQ,GACfA,EAAO,IAAM,OAAO,aACpBD,EAAa,WAAW,aAAaC,EAAQD,CAAY"}