decentraland / decentraland/sites
[Feature]: add click tracking to homepage platform-switch icons and mobile store buttons
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 48
Description
### Summary
Add click tracking to the platform-switch icons and mobile-store buttons in the homepage (`/`) Hero and Come Hang Out sections. These controls currently have no tracking at all, so switching to the other desktop platform's download link, opening the iOS/Android QR modal, or tapping a mobile store badge produces no analytics signal.
### Problem / Motivation
The Hero and Come Hang Out sections on the homepage have several interactive download-related elements that are not instrumented: the Win/macOS platform-switch icons, the iOS/Android QR-modal trigger icons, the mobile app-store badges, and (in Come Hang Out) the Epic Games button. This creates a tracking gap — we can't see how much download intent flows through these secondary controls versus the main CTA, which already tracks correctly via `trackDownloadClick` (introduced in #636).
### Priority
Medium — meaningful improvement, not blocking
### Target audience
Internal team
### Area
Tracking / Analytics
### Proposed Solution
Reuse the existing `trackDownloadClick` helper (from `useDownloadClick()` in `src/hooks/useDownloadClick.ts`, added in PR #636 and already wired to the main CTA and Epic button in the Hero) by adding `onClick`/`data-*` attributes to the currently-untracked elements — no new tracking mechanism needed.
Adopt **Option A**: a dedicated `*_PLATFORM_SWITCH` place enum per section, with the platform identified via a `data-os` attribute, rather than overloading the existing place values. Concretely:
- Add `COME_HANG_OUT_PLATFORM_SWITCH = 'come-hang-out-platform-switch'` to the `DownloadPlace` enum in `src/modules/segment.types.ts` (symmetric with the existing `LANDING_HERO_PLATFORM_SWITCH`).
- In `src/components/Home/Hero/Hero.tsx`: add `onClick={trackDownloadClick}` + `data-event`/`data-place={DownloadPlace.LANDING_HERO_PLATFORM_SWITCH}`/`data-os` to the Win/macOS switch icons; call `trackDownloadClick(e)` inside the existing iOS/Android QR-icon `onClick` handlers (before their existing `setMobileModalOs(...)` logic) with the same `data-*` attributes; add the same tracking to the mobile app-store buttons with `data-place={SectionViewedTrack.LANDING_HERO}`.
- In `src/components/Home/ComeHangOut/ComeHangOut.tsx`: identical treatment for its switch/QR icons using `data-place={DownloadPlace.COME_HANG_OUT_PLATFORM_SWITCH}`, its mobile store buttons using `data-place={SectionViewedTrack.LANDING_COME_HANG_OUT}`, and add tracking (`data-place={DownloadPlace.COME_HANG_OUT}`) to the Epic button, which currently has none.
This is a tracking-only change: it only adds `onClick` handlers and `data-*` attributes to elements that currently have none (or augments an existing handler without replacing its logic). No `href`, navigation target, or existing CTA/Epic-button wiring is touched, and no markup/layout/visual changes are introduced.
### Acceptance Criteria
- [ ] `DownloadPlace` enum in `src/modules/segment.types.ts` gains `COME_HANG_OUT_PLATFORM_SWITCH`
- [ ] `Hero.tsx` platform-switch icons, iOS/Android QR icons, and mobile store buttons are instrumented with `trackDownloadClick` + correct `data-event`/`data-os`/`data-place`, without touching the existing main CTA or Epic button wiring
- [ ] `ComeHangOut.tsx` switch/QR icons, mobile store buttons, and the Epic button are instrumented the same way
- [ ] Focused specs cover the newly-tracked controls (desktop and mobile) and `/coverage-guard` (95% statements/lines/functions floor) passes
Explicitly out of scope, but worth stating for reviewers: no UI/visual changes, no `href`/navigation changes — this is tracking wiring only, and it does not affect existing `download_started`/`download_success` data.
### Out of scope
- `src/components/DownloadOptions/DownloadOptions.tsx` (`/download` page) and `PlayPage` — already have platform tracking (`DownloadPlace.PLAY_HERO_APP_STORE` / `_GOOGLE_PLAY`).
- `Section Viewed` event fixes, `useTrackClick.ts`/`useSectionViewed.ts` creation, tracking-doc namespace fixes, `download_funnel_exit` payload fixes — separate findings from an earlier doc review, to be handled independently.
- Any `href`, navigation target, or existing CTA/Epic-button wiring already handled by PR #636.
- Any visual/UI/layout change of any kind.
Contributor guide
Assessment
This issue has not been assessed yet.