Skip to content

feat(landing): add PostHog tracking for CTA clicks, demo requests, and prompt submissions#3994

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/landing-cta-tracking
Apr 6, 2026
Merged

feat(landing): add PostHog tracking for CTA clicks, demo requests, and prompt submissions#3994
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/landing-cta-tracking

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add landing_cta_clicked event tracking to all landing page CTAs (hero, navbar, footer, pricing)
  • Add landing_demo_request_submitted event on successful demo form submission
  • Add landing_prompt_submitted event for all prompt input submissions (hero preview, preview panel, footer CTA)
  • Add trackLandingCta helper in landing-analytics.tsx for clean, consistent CTA tracking

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 6, 2026 7:43pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 6, 2026

PR Summary

Low Risk
Low risk: adds client-side analytics capture calls on landing-page interactions without changing business logic or server APIs.

Overview
Adds PostHog tracking across the landing page for key conversion actions.

Introduces a typed trackLandingCta helper and wires landing_cta_clicked into hero, navbar (desktop + mobile), pricing, and footer CTAs; also captures landing_prompt_submitted when users submit prompts from landing inputs and landing_demo_request_submitted after a successful demo request (including company_size).

Extends the PostHog event catalog (PostHogEventMap) with these new landing events to enforce property shapes at capture sites.

Reviewed by Cursor Bugbot for commit 24a2dd2. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 6, 2026

Greptile Summary

This PR adds PostHog analytics tracking across the Sim landing page, covering three categories of user interaction: CTA button clicks (landing_cta_clicked), demo form submissions (landing_demo_request_submitted), and prompt submissions from any of the three landing-page input areas (landing_prompt_submitted).

Key changes:

  • Three new strongly-typed events added to PostHogEventMap in events.ts, maintaining the compile-time safety contract shared by all call sites
  • A trackLandingCta helper exported from landing-analytics.tsx provides a single, consistent entry point for all CTA tracking — used across hero, navbar, footer, and pricing components
  • captureClientEvent is called directly for landing_prompt_submitted in the three prompt-input components, which is appropriate since no equivalent wrapper was added for that event
  • The demo modal captures company_size from the Zod-validated payload on successful HTTP submission only, so the event is never fired on validation failure or network error
  • All components that import trackLandingCta from landing-analytics.tsx (which carries 'use client') are themselves client components, so the import chain is valid

The implementation is clean and consistent with existing PostHog patterns in the codebase. No issues found.

Confidence Score: 5/5

This PR is safe to merge — it adds purely additive analytics tracking with no logic changes to existing functionality.

All 9 changed files pass review with no bugs, logic errors, or rule violations. Events are properly typed, call sites are correct, and the trackLandingCta abstraction is a clean, consistent pattern. No P0 or P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/posthog/events.ts Adds 3 new typed events (landing_cta_clicked, landing_demo_request_submitted, landing_prompt_submitted) to the PostHogEventMap catalog
apps/sim/app/(landing)/landing-analytics.tsx Adds trackLandingCta helper — thin typed wrapper around captureClientEvent for landing CTA click events
apps/sim/app/(landing)/components/demo-request/demo-request-modal.tsx Captures landing_demo_request_submitted with company_size on successful form submission inside the try block
apps/sim/app/(landing)/components/footer/footer-cta.tsx Tracks landing_prompt_submitted on submit and uses trackLandingCta for Docs and Get started CTA buttons
apps/sim/app/(landing)/components/hero/hero.tsx Adds trackLandingCta to Get a demo (destination: demo_modal) and Get started (/signup) CTA buttons
apps/sim/app/(landing)/components/landing-preview/components/landing-preview-home/landing-preview-home.tsx Tracks landing_prompt_submitted in handleSubmit for the hero home preview prompt input
apps/sim/app/(landing)/components/landing-preview/components/landing-preview-panel/landing-preview-panel.tsx Tracks landing_prompt_submitted in the copilot panel's handleSubmit, consistent with other prompt inputs
apps/sim/app/(landing)/components/navbar/navbar.tsx Adds trackLandingCta to all navbar CTAs (Log in, Get started, Go to App) in both desktop and mobile menu states
apps/sim/app/(landing)/components/pricing/pricing.tsx Adds trackLandingCta to all pricing tier CTAs with dynamic destination derived from tier.cta.href

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User visits Landing Page] -->|LandingAnalytics| B[landing_page_viewed]
    
    subgraph CTA_Clicks[CTA Clicks → landing_cta_clicked]
        C1[Hero: Get a demo]
        C2[Hero: Get started]
        C3[Navbar: Log in / Get started / Go to App]
        C4[Footer: Docs / Get started]
        C5[Pricing: Tier CTAs]
    end
    
    subgraph Prompt_Submit[Prompt Submit → landing_prompt_submitted]
        P1[LandingPreviewHome textarea]
        P2[LandingPreviewPanel copilot input]
        P3[FooterCTA textarea]
    end
    
    subgraph Demo_Form[Demo Form → landing_demo_request_submitted]
        D1[DemoRequestModal form]
        D2{HTTP success?}
        D3[Capture with company_size]
    end
    
    CTA_Clicks -->|trackLandingCta| E[captureClientEvent]
    Prompt_Submit -->|captureClientEvent direct| E
    D1 --> D2
    D2 -->|Yes| D3
    D3 --> E
    E --> F[posthog.capture]
    F --> G[PostHog Analytics]
Loading

Reviews (2): Last reviewed commit: "chore(landing): apply linter import sort..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 24a2dd2. Configure here.

@waleedlatif1 waleedlatif1 merged commit cd5cee3 into staging Apr 6, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/landing-cta-tracking branch April 6, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant