From e1b35c3b45cd24b347075c0bef28ccd969d947be Mon Sep 17 00:00:00 2001 From: Theodore Li Date: Tue, 4 Aug 2026 12:39:25 -0700 Subject: [PATCH] fix(landing): restore homepage view tracking --- apps/sim/app/(landing)/landing.test.tsx | 36 +++++++++++++++++++++++++ apps/sim/app/(landing)/landing.tsx | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 apps/sim/app/(landing)/landing.test.tsx diff --git a/apps/sim/app/(landing)/landing.test.tsx b/apps/sim/app/(landing)/landing.test.tsx new file mode 100644 index 00000000000..bfb21e0c574 --- /dev/null +++ b/apps/sim/app/(landing)/landing.test.tsx @@ -0,0 +1,36 @@ +/** + * @vitest-environment node + */ +import { renderToStaticMarkup } from 'react-dom/server' +import { describe, expect, it, vi } from 'vitest' + +vi.mock('@sim/emcn', () => ({ + cn: (...values: Array) => values.filter(Boolean).join(' '), +})) + +vi.mock('@/app/(landing)/components', () => ({ + Cta: () => null, + Features: () => null, + Hero: () => null, + HomeStructuredData: () => null, + Mothership: () => null, + ProductDemo: () => null, +})) + +vi.mock('@/app/(landing)/components/landing-layout', () => ({ + LANDING_SECTION_RHYTHM: 'gap-test', +})) + +vi.mock('@/app/(landing)/landing-analytics', () => ({ + LandingAnalytics: () => landing-analytics-marker, +})) + +import Landing from '@/app/(landing)/landing' + +describe('Landing', () => { + it('mounts the landing page analytics tracker exactly once', () => { + const markup = renderToStaticMarkup() + + expect(markup.match(/landing-analytics-marker/g)).toHaveLength(1) + }) +}) diff --git a/apps/sim/app/(landing)/landing.tsx b/apps/sim/app/(landing)/landing.tsx index 5eabaaaeb2c..84260a613ff 100644 --- a/apps/sim/app/(landing)/landing.tsx +++ b/apps/sim/app/(landing)/landing.tsx @@ -8,6 +8,7 @@ import { ProductDemo, } from '@/app/(landing)/components' import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layout' +import { LandingAnalytics } from '@/app/(landing)/landing-analytics' /** * Landing page root - owns the section order and the `
` content region. @@ -26,6 +27,7 @@ import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layou export default function Landing() { return (
+