feat: add more Umami tracking events

New events:
- run_code (with module, lesson, playground flag)
- logo_click
- privacy_open
- imprint_open
- setting_change (with setting name and value)
This commit is contained in:
2026-01-16 15:18:23 +01:00
parent 11877e8e7a
commit e0cee41482

View File

@@ -869,6 +869,8 @@ function runCode() {
const engineState = lessonEngine.getCurrentState(); const engineState = lessonEngine.getCurrentState();
const isPlayground = engineState.lesson?.mode === "playground"; const isPlayground = engineState.lesson?.mode === "playground";
track("run_code", { module: engineState.module?.id, lesson: engineState.lessonIndex, playground: isPlayground });
// Rotate the Run button icon // Rotate the Run button icon
const runButtonImg = document.querySelector("#run-btn img"); const runButtonImg = document.querySelector("#run-btn img");
if (runButtonImg) { if (runButtonImg) {
@@ -2479,6 +2481,7 @@ function init() {
e.preventDefault(); e.preventDefault();
navigateTo(""); navigateTo("");
showLandingPage(); showLandingPage();
track("logo_click");
}); });
// Language select // Language select
@@ -2536,10 +2539,16 @@ function init() {
const imprintDialog = document.getElementById("imprint-dialog"); const imprintDialog = document.getElementById("imprint-dialog");
document.querySelectorAll(".privacy-link").forEach((btn) => { document.querySelectorAll(".privacy-link").forEach((btn) => {
btn.addEventListener("click", () => privacyDialog?.showModal()); btn.addEventListener("click", () => {
privacyDialog?.showModal();
track("privacy_open");
});
}); });
document.querySelectorAll(".imprint-link").forEach((btn) => { document.querySelectorAll(".imprint-link").forEach((btn) => {
btn.addEventListener("click", () => imprintDialog?.showModal()); btn.addEventListener("click", () => {
imprintDialog?.showModal();
track("imprint_open");
});
}); });
document.querySelector(".privacy-dialog-close")?.addEventListener("click", () => { document.querySelector(".privacy-dialog-close")?.addEventListener("click", () => {
@@ -2560,6 +2569,7 @@ function init() {
elements.disableFeedbackToggle.addEventListener("change", (e) => { elements.disableFeedbackToggle.addEventListener("change", (e) => {
state.userSettings.disableFeedbackErrors = !e.target.checked; state.userSettings.disableFeedbackErrors = !e.target.checked;
saveUserSettings(); saveUserSettings();
track("setting_change", { setting: "feedback_errors", enabled: e.target.checked });
}); });
// Click on editor content to focus CodeMirror // Click on editor content to focus CodeMirror