feat: integrate GoatCounter analytics for event tracking across modals and snippets

This commit is contained in:
2025-10-16 22:59:54 +03:00
parent 8b056b66e7
commit e7d3669772
5 changed files with 65 additions and 0 deletions

View File

@@ -210,6 +210,20 @@ const Toast = {
}
};
// Analytics utility: Track events with GoatCounter
const Analytics = {
track(eventName, title) {
// Only track if GoatCounter is loaded
if (window.goatcounter && window.goatcounter.count) {
window.goatcounter.count({
path: eventName,
title: title || eventName,
event: true,
});
}
}
};
// Shared utility: Format bytes for display
function formatBytes(bytes) {
if (bytes === null || bytes === undefined) return 'N/A';