Skip to content

Commit e0cee41

Browse files
committed
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)
1 parent 11877e8 commit e0cee41

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/app.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,8 @@ function runCode() {
869869
const engineState = lessonEngine.getCurrentState();
870870
const isPlayground = engineState.lesson?.mode === "playground";
871871

872+
track("run_code", { module: engineState.module?.id, lesson: engineState.lessonIndex, playground: isPlayground });
873+
872874
// Rotate the Run button icon
873875
const runButtonImg = document.querySelector("#run-btn img");
874876
if (runButtonImg) {
@@ -2479,6 +2481,7 @@ function init() {
24792481
e.preventDefault();
24802482
navigateTo("");
24812483
showLandingPage();
2484+
track("logo_click");
24822485
});
24832486

24842487
// Language select
@@ -2536,10 +2539,16 @@ function init() {
25362539
const imprintDialog = document.getElementById("imprint-dialog");
25372540

25382541
document.querySelectorAll(".privacy-link").forEach((btn) => {
2539-
btn.addEventListener("click", () => privacyDialog?.showModal());
2542+
btn.addEventListener("click", () => {
2543+
privacyDialog?.showModal();
2544+
track("privacy_open");
2545+
});
25402546
});
25412547
document.querySelectorAll(".imprint-link").forEach((btn) => {
2542-
btn.addEventListener("click", () => imprintDialog?.showModal());
2548+
btn.addEventListener("click", () => {
2549+
imprintDialog?.showModal();
2550+
track("imprint_open");
2551+
});
25432552
});
25442553

25452554
document.querySelector(".privacy-dialog-close")?.addEventListener("click", () => {
@@ -2560,6 +2569,7 @@ function init() {
25602569
elements.disableFeedbackToggle.addEventListener("change", (e) => {
25612570
state.userSettings.disableFeedbackErrors = !e.target.checked;
25622571
saveUserSettings();
2572+
track("setting_change", { setting: "feedback_errors", enabled: e.target.checked });
25632573
});
25642574

25652575
// Click on editor content to focus CodeMirror

0 commit comments

Comments
 (0)