From 8e6a38381fc2f9bfc2f9c5496f143b409f63c6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sun, 9 Oct 2022 14:20:52 +0200 Subject: [PATCH] Send interactions events --- src/components/molecules/Switcher.svelte | 4 ++++ src/utils/functions/index.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/components/molecules/Switcher.svelte b/src/components/molecules/Switcher.svelte index 37d58d0..d12cb5d 100644 --- a/src/components/molecules/Switcher.svelte +++ b/src/components/molecules/Switcher.svelte @@ -6,6 +6,7 @@ import { page } from '$app/stores' import { getContext } from 'svelte' import reveal from '$animations/reveal' + import { sendEvent } from '$utils/analytics' // Components import Icon from '$components/atoms/Icon.svelte' @@ -20,6 +21,9 @@ */ const toggleSwitcher = () => { isOpen = !isOpen + + // Record opening event + !isOpen && sendEvent({ action: 'switcherOpen' }) } /** diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index 39f8bc6..6b34322 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -1,3 +1,6 @@ +import { sendEvent } from '$utils/analytics' + + /** * Throttle function */ @@ -150,6 +153,9 @@ export const mailtoClipboard = (node: HTMLElement) => { detail: { email: emailAddress } })) + // Record event in analytics + sendEvent({ action: 'emailCopy' }) + event.preventDefault() }