Send interactions events

This commit is contained in:
2022-10-09 14:20:52 +02:00
parent 25ed96ed2e
commit 8e6a38381f
2 changed files with 10 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
import { page } from '$app/stores' import { page } from '$app/stores'
import { getContext } from 'svelte' import { getContext } from 'svelte'
import reveal from '$animations/reveal' import reveal from '$animations/reveal'
import { sendEvent } from '$utils/analytics'
// Components // Components
import Icon from '$components/atoms/Icon.svelte' import Icon from '$components/atoms/Icon.svelte'
@@ -20,6 +21,9 @@
*/ */
const toggleSwitcher = () => { const toggleSwitcher = () => {
isOpen = !isOpen isOpen = !isOpen
// Record opening event
!isOpen && sendEvent({ action: 'switcherOpen' })
} }
/** /**

View File

@@ -1,3 +1,6 @@
import { sendEvent } from '$utils/analytics'
/** /**
* Throttle function * Throttle function
*/ */
@@ -150,6 +153,9 @@ export const mailtoClipboard = (node: HTMLElement) => {
detail: { email: emailAddress } detail: { email: emailAddress }
})) }))
// Record event in analytics
sendEvent({ action: 'emailCopy' })
event.preventDefault() event.preventDefault()
} }