Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions amplitude.js
Original file line number Diff line number Diff line change
@@ -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 */ }
})();
18 changes: 18 additions & 0 deletions hubspot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function () {
try {
if (typeof window === 'undefined') return;

var PROD_HOSTS = ['flox.dev', 'www.flox.dev', 'flox.mintlify.dev'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall there's a setting to add a domain to HubSpot for this to work, so it may be worth confirming.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked. this is applicable if we go subdomain like docs.flox.dev apparently flox.dev/docs uses the same one as the main site.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was referring to the *.mintlify.dev domain.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay done ✅

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 */ }
})();
Loading