diff --git a/amplitude.js b/amplitude.js new file mode 100644 index 0000000..553021c --- /dev/null +++ b/amplitude.js @@ -0,0 +1,57 @@ +(function () { + try { + if (typeof window === 'undefined') return; + + var PROD_HOSTS = ['flox.dev', 'www.flox.dev', 'flox.mintlify.dev']; + var AMPLITUDE_API_KEY = PROD_HOSTS.indexOf(location.hostname) !== -1 + ? '6f89e78c468a7da6fecfd717437fcb32' + : '820bc93b6feb09134fb8ed7b25af09a1'; + + window._hsp = window._hsp || []; + window._hsp.push([ + 'addPrivacyConsentListener', + function (consent) { + try { + if (!(consent && consent.categories && consent.categories.analytics)) return; + if (document.getElementById('amplitude-script-loaded')) return; + + var b = document.createElement('script'); + b.id = 'amplitude-script-loaded'; + b.type = 'text/javascript'; + b.async = true; + b.src = 'https://cdn.amplitude.com/script/' + AMPLITUDE_API_KEY + '.js'; + b.onload = function () { + try { + if (!window.amplitude || typeof window.amplitude.init !== 'function') return; + + if (window.sessionReplay && typeof window.sessionReplay.plugin === 'function') { + window.amplitude.add(window.sessionReplay.plugin({ sampleRate: 0.3 })); + } + + window.amplitude.init(AMPLITUDE_API_KEY, { + fetchRemoteConfig: true, + autocapture: { + attribution: true, + fileDownloads: true, + formInteractions: true, + pageViews: true, + sessions: true, + elementInteractions: true, + networkTracking: true, + webVitals: true, + frustrationInteractions: { + thrashedCursor: true, + errorClicks: true, + deadClicks: true, + rageClicks: true + } + } + }); + } catch (e) { /* noop */ } + }; + document.head.appendChild(b); + } catch (e) { /* noop */ } + } + ]); + } catch (e) { /* noop */ } +})(); diff --git a/hubspot.js b/hubspot.js new file mode 100644 index 0000000..550f400 --- /dev/null +++ b/hubspot.js @@ -0,0 +1,18 @@ +(function () { + try { + if (typeof window === 'undefined') return; + + var PROD_HOSTS = ['flox.dev', 'www.flox.dev', 'flox.mintlify.dev']; + if (PROD_HOSTS.indexOf(location.hostname) === -1) return; + + if (document.getElementById('hs-script-loader')) return; + + var s = document.createElement('script'); + s.id = 'hs-script-loader'; + s.type = 'text/javascript'; + s.async = true; + s.defer = true; + s.src = '//js.hs-scripts.com/23414950.js'; + document.head.appendChild(s); + } catch (e) { /* noop */ } +})();