Skip to content

feat(landing): add analytics events for audience goals - #740

Open
vvtimofeev wants to merge 1 commit into
mainfrom
feat/landing-analytics-events
Open

feat(landing): add analytics events for audience goals#740
vvtimofeev wants to merge 1 commit into
mainfrom
feat/landing-analytics-events

Conversation

@vvtimofeev

Copy link
Copy Markdown
Contributor

What

Adds a unified analytics layer and wires up conversion events across the site, so both Yandex Metrika and GA4 can segment the audience (developers installing, designers, evaluators) instead of only counting page views.

  • src/utils/analytics.ts — single entry point: pushes a cta event (cta_action + cta_label) to the GTM dataLayer; logs to console in dev.
  • src/hooks/useAnalyticsOutboundLinks.ts — delegated capture-phase listener for outbound GitHub/Figma links (they live in page-constructor content and MDX, so per-component handlers don't scale). Also covers Storybook-style subdomain gaps that GA4 enhanced measurement misses.

Events

Action Where Label
install_copy Start Creating block, copy install command ai / manual
start_creating_view Start Creating block enters viewport (once per view)
prompt_copy Start Creating block, copy AI prompt example example number
tab_switch Start Creating block tabs ai / manual
howto_start_click hero "How to Start" button rtl for RTL landing
theme_export Themer, Save as CSS/JSON css / json
icon_download icon dialog, download SVG icon name
github_click any github.com link owner/repo
figma_open any figma.com link file path

Wiring

Matching JS goals are already registered in Metrika counter 94770252 (identifiers equal cta_action). To go live, GTM container GTM-KHT6KD7 needs one Custom Event trigger (cta) with two tags: a GA4 event ({{cta_action}}, param label) and ym(94770252, 'reachGoal', {{cta_action}}, {label: {{cta_label}}}). In GA4, register cta_label as an event-scoped custom dimension and mark the key events.

Testing

Verified in dev preview via console logging: every event fires with the expected label; start_creating_view fires exactly once and only when the block becomes visible. npm run typecheck and ESLint pass; pre-commit lint-staged clean.

🤖 Generated with Claude Code

Send a unified `cta` event to the GTM dataLayer (logged to console in dev)
and wire it up across the site:

- install_copy (ai/manual) — copy install command in Start Creating block
- start_creating_view / prompt_copy / tab_switch / howto_start_click —
  Start Creating block funnel: visibility, AI prompt examples, tabs, hero CTA
- theme_export (css/json) — save theme in Themer
- icon_download — download SVG from the icon dialog
- github_click / figma_open — delegated outbound link tracking
  (GitHub and Figma links live in page-constructor content, so a global
  capture-phase listener is used instead of per-component handlers)

Matching JS goals are registered in Yandex Metrika counter 94770252;
GTM routes the same event to GA4 and Metrika reachGoal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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