Commit 7375d41
Add posthog enrollment_cta_clicked event with enrollment-specific data (#3542)
* feat(cta-tracking): emit dedicated enroll_cta_clicked event (hq#11941)
Course enroll CTAs fired the generic `cta_clicked` event keyed on the visible
button copy, so analytics insights broke whenever labels changed (hq#11941) —
and the infobox redesign changes them again.
Emit a dedicated `enroll_cta_clicked` event from the course enroll handlers
(header + infobox) with structured, copy-independent properties:
- placement: "header" | "infobox"
- enrollment_mode: "verified" | "audit"
- resource_type, readable_id (+ label retained for humans, not as the key)
Placement is threaded via a new useCourseEnrollment opt set by each call site.
Generic cta_clicked is unchanged elsewhere.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* harden(cta-tracking): require placement, add platform, camelCase props
Review follow-ups on the dedicated enroll_cta_clicked event:
- Make `placement` required in the useCourseEnrollment opts so a future call
site can't silently emit `placement: undefined` (the same silent-drop class
hq#11941 fixes). Both existing call sites already pass it.
- Add `platform: PlatformEnum.Mitxonline` for parity with sibling cta events
(constant on these product pages; was not on the old course-enroll event).
- Use camelCase property keys (enrollmentMode/resourceType/readableId) to match
the repo's established convention across all ~15 capture sites, so `readableId`
lines up with the legacy cta_clicked for a clean cross-event breakdown.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(cta-tracking): group analytics-only opts under `tracking`
`useCourseEnrollment`'s opts mixed analytics metadata (`placement`, used only
for the enroll_cta_clicked event) with behavior (`onRequireSignup`). Group the
analytics-only field under a `tracking` key so the two intents are structurally
separated:
useCourseEnrollment(course, run, {
tracking: { placement: "infobox" }, // analytics-only
onRequireSignup, // behavioral
})
No behavior change. Checked the sibling handlers — ProgramEnrollmentButton and
the other capture sites fire inline without a mixed opts object, so none need an
analogous change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 08c026a commit 7375d41
5 files changed
Lines changed: 84 additions & 12 deletions
File tree
- frontends/main/src
- app-pages/ProductPages
- common
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
Lines changed: 58 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
514 | 518 | | |
515 | 519 | | |
516 | 520 | | |
| |||
533 | 537 | | |
534 | 538 | | |
535 | 539 | | |
536 | | - | |
| 540 | + | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
| |||
550 | 554 | | |
551 | 555 | | |
552 | 556 | | |
553 | | - | |
554 | | - | |
555 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
556 | 564 | | |
557 | 565 | | |
558 | 566 | | |
| |||
567 | 575 | | |
568 | 576 | | |
569 | 577 | | |
570 | | - | |
| 578 | + | |
571 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
572 | 583 | | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
573 | 624 | | |
| 625 | + | |
574 | 626 | | |
575 | 627 | | |
576 | 628 | | |
| |||
Lines changed: 20 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | | - | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
| |||
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
80 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
81 | 93 | | |
82 | | - | |
83 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
| 98 | + | |
| 99 | + | |
85 | 100 | | |
86 | 101 | | |
87 | 102 | | |
| |||
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
93 | | - | |
| 108 | + | |
94 | 109 | | |
95 | 110 | | |
96 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
0 commit comments