diff --git a/src/lib/helpers/analytics.ts b/src/lib/helpers/analytics.ts index 5ba58c1e..c9431b08 100644 --- a/src/lib/helpers/analytics.ts +++ b/src/lib/helpers/analytics.ts @@ -180,3 +180,14 @@ export function trackSourcesClick(learningUnitId: string) { learning_unit_id: learningUnitId, }); } + +/** + * Tracks when the profile is clicked. + */ +export function trackProfileClick() { + if (!browser) { + return; + } + + window.gtag('event', 'profile_click'); +} diff --git a/src/routes/(protected)/(core)/+layout.svelte b/src/routes/(protected)/(core)/+layout.svelte index 1aae461a..e5879ac5 100644 --- a/src/routes/(protected)/(core)/+layout.svelte +++ b/src/routes/(protected)/(core)/+layout.svelte @@ -1,7 +1,9 @@
@@ -34,6 +40,7 @@ href="/profile" aria-label="Profile" class="h-10 w-10 cursor-pointer overflow-hidden rounded-full" + onclick={handleProfileClick} > profile diff --git a/src/routes/(protected)/unit/[id]/quiz/+page.svelte b/src/routes/(protected)/unit/[id]/quiz/+page.svelte index 21688331..2fbf3bc2 100644 --- a/src/routes/(protected)/unit/[id]/quiz/+page.svelte +++ b/src/routes/(protected)/unit/[id]/quiz/+page.svelte @@ -8,6 +8,7 @@ import { Button, LinkButton } from '$lib/components/Button/index.js'; import { Modal } from '$lib/components/Modal/index.js'; import { + HOME_PATH, IsWithinViewport, noop, trackQuizAttempt, @@ -303,7 +304,7 @@ Back to home