Skip to content

feat(tile-usage-analytics): per-tile click analytics + archive - #9

Merged
rubenvdlinde merged 2 commits into
developmentfrom
wip/build-tile-analytics-2026-07-23
Jul 23, 2026
Merged

feat(tile-usage-analytics): per-tile click analytics + archive#9
rubenvdlinde merged 2 commits into
developmentfrom
wip/build-tile-analytics-2026-07-23

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Implements and archives tile-usage-analytics, extending the existing dashboard-view-analytics capability rather than duplicating it.

What

  • oc_launchpad_tile_clicks aggregate table (composite unique index on (placement_uuid, click_bucket) so repeat clicks increment in place). No per-event rows, ever.
  • TileAnalyticsService delegates gating to the existing AnalyticsService::isGloballyEnabled()/isUserOptedOut() and dedup to the existing UniqueViewerDedupno second opt-out setting, no second salt.
  • POST /api/tile-click/{placementId} to record; admin-guarded top-tiles / per-dashboard / CSV endpoints.
  • The existing PurgeViewsJob was extended to purge both tables in one run — no second job.
  • Fire-and-forget client hook that fails open, so a failed beacon never blocks navigation.

Verification (local, no CI wait)

  • phpunit --filter 'TileAnalytics|PurgeViewsJob'OK (29 tests, 47 assertions); full suite 1335 tests, 3302 assertions OK.
  • npx vitest run45 files / 414 tests pass.
  • Privacy behaviour is directly tested: recording is a no-op when analytics_enabled is false and for an opted-out user; repeat clicks by the same actor increment clickCount but not uniqueActorCount.

Two defects I fixed before merging

  1. Migration class collision — this change and admin-template-resync both generated Version002006Date20260723000000. Renumbered here to Version002007Date20260724000000; tests re-run green after the rename.
  2. @spec targets — all 20 tags pointed at the change directory, which breaks the moment the change is archived. Retargeted to the canonical openspec/specs/dashboard-view-analytics/spec.md.

Not done

No admin-UI page for the new reports (not required by tasks.md); no e2e; no live-DB migration test (no precedent for the sibling table either).

…shboard-view-analytics

Adds an aggregate-only oc_launchpad_tile_clicks table, TileAnalyticsService,
TileAnalyticsController, and a fire-and-forget frontend hook that records
tile activations. Reuses the existing dashboard-view-analytics privacy
machinery wholesale: the same salted-daily-hash unique-actor dedup
(UniqueViewerDedup), the same analytics_enabled/analytics_optout gates
(delegated to AnalyticsService), the same SaltRotationJob, and the
existing PurgeViewsJob (extended to purge the new table in the same run).
No per-event rows are ever persisted; no new opt-out surface is introduced.

openspec/changes/tile-usage-analytics
 to canonical spec; archive

- Migration renumbered 002006->002007 (Date20260724) to avoid a class-name
  collision with admin-template-resync's Version002006Date20260723000000.
- All 20 @SPEC tags retargeted from the change dir to the canonical
  openspec/specs/dashboard-view-analytics/spec.md — a change-dir target
  breaks the moment the change is archived.
- Change archived.

29 phpunit tests / 47 assertions pass after the rename.
@rubenvdlinde
rubenvdlinde merged commit 5a4cfbc into development Jul 23, 2026
1 check failed
@rubenvdlinde
rubenvdlinde deleted the wip/build-tile-analytics-2026-07-23 branch August 14, 2026 09:33
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