diff --git a/src/components/Analytics.svelte b/src/components/Analytics.svelte index e615512..69fe017 100644 --- a/src/components/Analytics.svelte +++ b/src/components/Analytics.svelte @@ -1,37 +1,15 @@ {#if enabled} - + {/if} - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/molecules/EmailForm.svelte b/src/components/molecules/EmailForm.svelte index 180e2e4..1c5b896 100644 --- a/src/components/molecules/EmailForm.svelte +++ b/src/components/molecules/EmailForm.svelte @@ -31,7 +31,7 @@ // If successful if (result.data.success) { - sendEvent({ action: 'newsletterSubscribe' }) + sendEvent('newsletterSubscribe') update() } else { // Hide message for errors diff --git a/src/components/molecules/Switcher.svelte b/src/components/molecules/Switcher.svelte index d12cb5d..6cbb918 100644 --- a/src/components/molecules/Switcher.svelte +++ b/src/components/molecules/Switcher.svelte @@ -23,7 +23,7 @@ isOpen = !isOpen // Record opening event - !isOpen && sendEvent({ action: 'switcherOpen' }) + !isOpen && sendEvent('switcherOpen') } /** diff --git a/src/components/organisms/Locations.svelte b/src/components/organisms/Locations.svelte index ea0abd8..7b3e63c 100644 --- a/src/components/organisms/Locations.svelte +++ b/src/components/organisms/Locations.svelte @@ -54,7 +54,7 @@ class={'is-disabled'} on:click={() => { filterLocation(slug) - sendEvent({ action: 'filterContinent' }) + sendEvent('filterContinent') }} > diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index c486fe0..9d7105e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,7 +4,7 @@ import { browser } from '$app/environment' import { page } from '$app/stores' import { beforeNavigate } from '$app/navigation' - import { PUBLIC_ANALYTICS_KEY, PUBLIC_ANALYTICS_URL } from '$env/static/public' + import { PUBLIC_ANALYTICS_DOMAIN } from '$env/static/public' import type { PageData } from './$types' import { onMount, setContext } from 'svelte' import { pageLoading, previousPage } from '$utils/stores' @@ -77,8 +77,5 @@ {#if browser} - + {/if} \ No newline at end of file diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index dc79904..5223b15 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -319,7 +319,7 @@ { currentStep = index - sendEvent({ action: 'aboutStepSwitch' }) + sendEvent('aboutStepSwitch') }} > {title} diff --git a/src/utils/analytics.ts b/src/utils/analytics.ts index 7a2cd17..fa79ad5 100644 --- a/src/utils/analytics.ts +++ b/src/utils/analytics.ts @@ -1,21 +1,8 @@ // @ts-nocheck -// Send page -export const sendPage = (path: string = '') => { - if (typeof Countly !== 'undefined') { - Countly.track_pageview(path) - } -} - // Send event -export const sendEvent = ({ action, segments = {}, amount = 1 }) => { - if (typeof Countly !== 'undefined') { - Countly.add_event({ - key: action, - count: amount, - segmentation: { - ...segments - } - }) +export const sendEvent = (action: string, props?: any) => { + if (typeof plausible !== 'undefined') { + plausible(action, props) } } \ No newline at end of file diff --git a/src/utils/functions/index.ts b/src/utils/functions/index.ts index 2757f87..3ada723 100644 --- a/src/utils/functions/index.ts +++ b/src/utils/functions/index.ts @@ -154,7 +154,7 @@ export const mailtoClipboard = (node: HTMLElement) => { })) // Record event in analytics - sendEvent({ action: 'emailCopy' }) + sendEvent('emailCopy') event.preventDefault() }