Files
openmotion/tests
open-design-crew[bot] 9d8f0696af feat(tracking): add Black Friday hero, model hub impressions, and remix-to-generation tracking (#1101)
* feat(tracking): add Black Friday hero, model hub impressions, and remix-to-generation tracking

Port the Cloud-compatible Black Friday and ModelHub analytics from #1067 onto main, wired directly to main's shared entitlement hook registry, global checkout-return refresh host, and template impression observer:

- Register bf_hero and bf_hub in shared/entitlement-hooks.ts (shared by tracking/events.ts, src/cloud-tracking.ts, and EntitlementModalHost), and extend the closed tracking schema for copy_prompt/copy_status/prompt_edited, hub_videos card surface_view, and hub_id/template_id/prompt_edited on asset_generation_submit_result.
- Split campaignPricingUrl mediums into openmotion_bf_hero (utm_medium=hero) and openmotion_bf_hub (utm_medium=model_hub) while keeping od_entry_source=openmotion_manage_subscription for AMR attribution.
- Add once-per-load bf_hero surface_view and bf_hero checkout-return tracking on ExploreBlackFridayHero, plus ModelHub showcase card impressions (via useTemplateImpressions), bf_hub promo pill attribution, category_select, open_detail, copy_prompt status, and start_use with template source handoff.
- Prevent impression spam and burst drops on Cloud: disable ModelHub's useTemplateImpressions observer while the lightbox dialog is open (avoiding idle timer loops and spurious close-time impressions), deduplicate showcase card impressions across remounts per page session, and raise the shared Cloud studioTracker queue capacity (maxQueue=1024, flushIntervalMs=500) in src/cloud-tracking.ts while keeping each PostHog /batch/ payload within 16 events / 64 KB.
- Attach campaign_id on AccountSettings view_plans clicks during the Black Friday window.
- Address review feedback from #1067: consume AssetDraft.source on successful submit, prompt reset, StudioIdeas prompt apply, or empty-prompt hub navigation (clearing both React state and in-memory studioDrafts without persisting) so later unrelated generations are not misattributed, and document all new hooks, mediums, and hub fields in tracking/README.md.

Backport-of: #1067 (partial, from commit 3fa762ae4)

* fix(tracking): re-subscribe ModelHub card impressions on masonry re-pack and wait for account state

---------

Co-authored-by: 罗高 <luogao@users.noreply.github.com>
2026-11-25 18:49:37 +08:00
..