From 3aa8315b964886a831e70f5bf3bfdc495f7ecbd0 Mon Sep 17 00:00:00 2001 From: Inline Pizza <249805557+InlinePizza@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:59:35 -0800 Subject: [PATCH 1/4] Add GA4 cta_click event tracking and Write the Docs announcement banner Add structured GA4 event tracking to all CTAs using data-track-* attributes and a global delegated click listener (AnalyticsClickTracker). Add a dismissable announcement banner for the Write the Docs pre-conference campaign with localStorage persistence. --- .../shared/AnalyticsClickTracker.astro | 36 +++++ .../shared/AnnouncementBanner.astro | 125 ++++++++++++++++++ src/components/shared/TopHeader.astro | 4 +- .../site/BrokenLinkReportForm.astro | 10 ++ src/components/site/FreeToolCard.astro | 2 +- src/components/site/Hero.astro | 10 ++ src/components/site/PricingCards.astro | 3 + src/components/site/pricing/PricingCard.astro | 4 +- src/components/site/pricing/pricing.config.ts | 4 + src/components/starlight/Header.astro | 10 ++ .../starlight/MobileMenuFooter.astro | 4 +- 11 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 src/components/shared/AnalyticsClickTracker.astro create mode 100644 src/components/shared/AnnouncementBanner.astro diff --git a/src/components/shared/AnalyticsClickTracker.astro b/src/components/shared/AnalyticsClickTracker.astro new file mode 100644 index 0000000..ef85fea --- /dev/null +++ b/src/components/shared/AnalyticsClickTracker.astro @@ -0,0 +1,36 @@ + diff --git a/src/components/shared/AnnouncementBanner.astro b/src/components/shared/AnnouncementBanner.astro new file mode 100644 index 0000000..245deab --- /dev/null +++ b/src/components/shared/AnnouncementBanner.astro @@ -0,0 +1,125 @@ +--- +interface Props { + campaign: string; + href: string; + message: string; + linkText: string; + ctaAction?: string; +} + +const { campaign, href, message, linkText, ctaAction = 'banner_cta' } = Astro.props; +const storageKey = `pl_banner_dismissed_${campaign}`; +--- + + + + + + diff --git a/src/components/shared/TopHeader.astro b/src/components/shared/TopHeader.astro index 5ef07c1..235ba44 100644 --- a/src/components/shared/TopHeader.astro +++ b/src/components/shared/TopHeader.astro @@ -19,8 +19,8 @@ const { activeSection = getActiveSection(Astro.url.pathname), showNavTools = fal {showNavTools ? : null}
- Sign up - Book demo + Sign up + Book demo
diff --git a/src/components/site/BrokenLinkReportForm.astro b/src/components/site/BrokenLinkReportForm.astro index 73db486..9f3c0e6 100644 --- a/src/components/site/BrokenLinkReportForm.astro +++ b/src/components/site/BrokenLinkReportForm.astro @@ -151,6 +151,16 @@ const apiBaseUrl = (rawApiBaseUrl || fallbackApiBaseUrl).replace(/\/+$/, ''); return; } + if (typeof gtag === 'function') { + gtag('event', 'cta_click', { + funnel_stage: 'evaluation', + action: 'broken_link_report', + location: 'free_tools', + campaign: '', + link_url: apiBase + '/public/free-tools/broken-link-report', + }); + } + submitButton.disabled = true; submitButton.dataset.loading = 'true'; setStatus('Submitting request...', 'neutral'); diff --git a/src/components/site/FreeToolCard.astro b/src/components/site/FreeToolCard.astro index 587877c..26c12b7 100644 --- a/src/components/site/FreeToolCard.astro +++ b/src/components/site/FreeToolCard.astro @@ -10,7 +10,7 @@ interface Props { const { title, description, href } = Astro.props; --- - + diff --git a/src/components/site/Hero.astro b/src/components/site/Hero.astro index cbb2204..1d180ff 100644 --- a/src/components/site/Hero.astro +++ b/src/components/site/Hero.astro @@ -60,6 +60,16 @@ const { form.addEventListener('submit', async (event) => { event.preventDefault(); + if (typeof gtag === 'function') { + gtag('event', 'cta_click', { + funnel_stage: 'conversion', + action: 'book_demo', + location: 'hero', + campaign: '', + link_url: form.action, + }); + } + if (submitButton instanceof HTMLButtonElement) { submitButton.disabled = true; submitButton.textContent = 'Submitting...'; diff --git a/src/components/site/PricingCards.astro b/src/components/site/PricingCards.astro index 0cb2db3..ee60e33 100644 --- a/src/components/site/PricingCards.astro +++ b/src/components/site/PricingCards.astro @@ -35,6 +35,7 @@ const defaultGrowthBundle = GROWTH_BUNDLE_OPTIONS[0]; features={STARTUP_FEATURES} ctaLabel={STARTUP_PLAN.ctaLabel} ctaHref={STARTUP_PLAN.ctaHref} + ctaAction={STARTUP_PLAN.ctaAction} /> @@ -61,6 +63,7 @@ const defaultGrowthBundle = GROWTH_BUNDLE_OPTIONS[0]; features={ENTERPRISE_FEATURES} ctaLabel={ENTERPRISE_PLAN.ctaLabel} ctaHref={ENTERPRISE_PLAN.ctaHref} + ctaAction={ENTERPRISE_PLAN.ctaAction} /> diff --git a/src/components/site/pricing/PricingCard.astro b/src/components/site/pricing/PricingCard.astro index 656c893..8697ee5 100644 --- a/src/components/site/pricing/PricingCard.astro +++ b/src/components/site/pricing/PricingCard.astro @@ -12,6 +12,7 @@ interface Props { features: string[]; ctaLabel: string; ctaHref: string; + ctaAction?: string; featured?: boolean; badge?: string; priceDataAttr?: string; @@ -28,6 +29,7 @@ const { features, ctaLabel, ctaHref, + ctaAction, featured = false, badge, priceDataAttr, @@ -79,5 +81,5 @@ const PlanIcon = PLAN_ICONS[planId]; - {ctaLabel} + {ctaLabel} diff --git a/src/components/site/pricing/pricing.config.ts b/src/components/site/pricing/pricing.config.ts index 4424a70..9aaf235 100644 --- a/src/components/site/pricing/pricing.config.ts +++ b/src/components/site/pricing/pricing.config.ts @@ -12,6 +12,7 @@ export interface PricingPlanConfig { summary: string; ctaLabel: string; ctaHref: string; + ctaAction: string; } export interface CompareRow { @@ -30,6 +31,7 @@ export const STARTUP_PLAN: PricingPlanConfig = { summary: 'For teams with small docs sites and standard integration needs.', ctaLabel: 'Sign up', ctaHref: 'https://accounts.gopromptless.ai/sign-up', + ctaAction: 'sign_up', }; export const GROWTH_PLAN: PricingPlanConfig = { @@ -38,6 +40,7 @@ export const GROWTH_PLAN: PricingPlanConfig = { summary: 'For teams with larger docs sites and broader integrations.', ctaLabel: 'Book demo', ctaHref: 'https://cal.com/team/promptless/15m-discovery-call', + ctaAction: 'book_demo', }; export const ENTERPRISE_PLAN: PricingPlanConfig = { @@ -46,6 +49,7 @@ export const ENTERPRISE_PLAN: PricingPlanConfig = { summary: 'For teams with massive docs sites or advanced governance needs.', ctaLabel: 'Book demo', ctaHref: 'https://cal.com/team/promptless/15m-discovery-call', + ctaAction: 'book_demo', }; export const GROWTH_BUNDLE_OPTIONS: GrowthBundleOption[] = [ diff --git a/src/components/starlight/Header.astro b/src/components/starlight/Header.astro index b27d3b4..b28c98b 100644 --- a/src/components/starlight/Header.astro +++ b/src/components/starlight/Header.astro @@ -2,14 +2,24 @@ import Search from '@astrojs/starlight/components/Search.astro'; import SiteTitle from './SiteTitle.astro'; import TopHeader from '@components/shared/TopHeader.astro'; +import AnnouncementBanner from '@components/shared/AnnouncementBanner.astro'; +import AnalyticsClickTracker from '@components/shared/AnalyticsClickTracker.astro'; --- +
+ diff --git a/src/components/starlight/Header.astro b/src/components/starlight/Header.astro index 648cb57..9c42cc3 100644 --- a/src/components/starlight/Header.astro +++ b/src/components/starlight/Header.astro @@ -2,7 +2,6 @@ import Search from '@astrojs/starlight/components/Search.astro'; import SiteTitle from './SiteTitle.astro'; import TopHeader from '@components/shared/TopHeader.astro'; -import AnnouncementBanner from '@components/shared/AnnouncementBanner.astro'; import AnalyticsClickTracker from '@components/shared/AnalyticsClickTracker.astro'; ---