diff --git a/apps/nextjs/src/app/aila/[id]/download/DownloadView.tsx b/apps/nextjs/src/app/aila/[id]/download/DownloadView.tsx index d580d112..5e65c6e9 100644 --- a/apps/nextjs/src/app/aila/[id]/download/DownloadView.tsx +++ b/apps/nextjs/src/app/aila/[id]/download/DownloadView.tsx @@ -87,6 +87,7 @@ export function DownloadView({ chat }: Readonly) { data={exportAllAssets.data} data-testid="chat-download-lesson-plan" lesson={lessonPlan} + chatId={id} /> ) => { const link = data && "link" in data ? data.link : ""; @@ -133,7 +134,7 @@ export const DownloadAllButton = ({ > { - trackDownload(ext, analyticsResourceType, lesson, track); + trackDownload(ext, analyticsResourceType, lesson, track, chatId); handleZipDownloadStatus(); }} className="flex w-full items-center justify-start gap-15 hover:underline" diff --git a/apps/nextjs/src/components/AppComponents/download/DownloadButton.tsx b/apps/nextjs/src/components/AppComponents/download/DownloadButton.tsx index 3f395066..145e705f 100644 --- a/apps/nextjs/src/components/AppComponents/download/DownloadButton.tsx +++ b/apps/nextjs/src/components/AppComponents/download/DownloadButton.tsx @@ -18,6 +18,7 @@ import SlidesIcon from "../../SVGParts/SlidesIcon"; import { SendEmailIcon } from "./DownloadAllButton"; export const DownloadButton = ({ + chatId, onClick, lesson, title, @@ -28,6 +29,7 @@ export const DownloadButton = ({ exportsType, "data-testid": dataTestId, }: { + chatId: string; onClick: () => void; lesson: LooseLessonPlan; title: string; @@ -60,7 +62,7 @@ export const DownloadButton = ({ > - trackDownload(ext, analyticsResourceType, lesson, track) + trackDownload(ext, analyticsResourceType, lesson, track, chatId) } className="flex w-full items-center justify-start gap-15 hover:underline" href={`/api/aila-download?fileId=${fileId}&ext=${ext}&lessonTitle=${lessonTitle}`} @@ -77,7 +79,7 @@ export const DownloadButton = ({ - trackDownload("pdf", analyticsResourceType, lesson, track) + trackDownload("pdf", analyticsResourceType, lesson, track, chatId) } className="flex w-full items-center justify-start gap-15 hover:underline" href={`/api/aila-download?fileId=${fileId}&ext=pdf&lessonTitle=${lessonTitle}`} @@ -98,6 +100,7 @@ export const DownloadButton = ({ analyticsResourceType, lesson, track, + chatId, ) } className="hidden w-full items-center justify-start gap-15 hover:underline sm:flex" diff --git a/apps/nextjs/src/utils/trackDownload.ts b/apps/nextjs/src/utils/trackDownload.ts index 8dd89fe6..1e867de0 100644 --- a/apps/nextjs/src/utils/trackDownload.ts +++ b/apps/nextjs/src/utils/trackDownload.ts @@ -12,8 +12,10 @@ export function trackDownload( analyticsResourceType: ResourceTypeValueType | ResourceTypeValueType[], lesson: LooseLessonPlan, track: ReturnType["track"], + chatId: string, ) { track.lessonPlanResourcesDownloaded({ + chatId, ...getLessonTrackingProps({ lesson }), resourceType: Array.isArray(analyticsResourceType) ? analyticsResourceType