From d2fb5db8d77b238ac9a705d6cc31f964dc3a9934 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 9 Nov 2023 03:49:21 +0000 Subject: [PATCH] feat: add event to course signup button --- .../CourseLandingPage/components/PricingSection.svelte | 7 +++++++ src/routes/invite/s/[hash]/+page.svelte | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/components/CourseLandingPage/components/PricingSection.svelte b/src/lib/components/CourseLandingPage/components/PricingSection.svelte index 7e18d24f..ec9eba5c 100644 --- a/src/lib/components/CourseLandingPage/components/PricingSection.svelte +++ b/src/lib/components/CourseLandingPage/components/PricingSection.svelte @@ -9,6 +9,7 @@ import PaymentModal from './PaymentModal.svelte'; import type { Course } from '$lib/utils/types'; import { ROLE } from '$lib/utils/constants/roles'; + import { capturePosthogEvent } from '$lib/utils/services/posthog'; export let className = ''; export let editMode = false; @@ -31,6 +32,12 @@ function handleJoinCourse() { if (editMode) return; + capturePosthogEvent('join_course', { + course_id: courseData.id, + course_title: courseData.title, + course_cost: courseData.cost, + course_free: isFree + }); if (isFree) { const link = getStudentInviteLink(courseData, $currentOrg.siteName); goto(link); diff --git a/src/routes/invite/s/[hash]/+page.svelte b/src/routes/invite/s/[hash]/+page.svelte index b9d6db17..875bbcfe 100644 --- a/src/routes/invite/s/[hash]/+page.svelte +++ b/src/routes/invite/s/[hash]/+page.svelte @@ -15,7 +15,7 @@ NOTIFICATION_NAME } from '$lib/utils/services/notification/notification'; import { snackbar } from '$lib/components/Snackbar/store.js'; - import { capturePosthogEvent } from '$lib/utils/services/posthog/index.js'; + import { capturePosthogEvent } from '$lib/utils/services/posthog'; export let data;