Skip to content

Commit 4f12ac7

Browse files
eventTypes structured
1 parent 76b9f5c commit 4f12ac7

File tree

7 files changed

+33
-7
lines changed

7 files changed

+33
-7
lines changed

dotcom-rendering/src/components/EpicContent.apps.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ export function EpicContent({
3131
if (impressionSeen && !reportedImpressionSeen) {
3232
void getAcquisitionsClient().epicSeen();
3333
setReportedImpressionSeen(true);
34-
document.dispatchEvent(new CustomEvent('EpicContent in view'));
34+
document.dispatchEvent(
35+
new CustomEvent('epic:in-view', {
36+
detail: {
37+
epicType: 'apps',
38+
},
39+
}),
40+
);
3541
}
3642
}, [impressionSeen, reportedImpressionSeen, setReportedImpressionSeen]);
3743

dotcom-rendering/src/components/SlotBodyEnd/BrazeEpic.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,13 @@ const BrazeEpicWithSatisfiedDependencies = ({
140140
renderingTarget,
141141
);
142142

143-
document.dispatchEvent(new CustomEvent('braze-epic:in-view'));
143+
document.dispatchEvent(
144+
new CustomEvent('epic:in-view', {
145+
detail: {
146+
epicType: 'braze',
147+
},
148+
}),
149+
);
144150
}
145151
}, [hasBeenSeen, meta, renderingTarget]);
146152

dotcom-rendering/src/components/StickyBottomBanner/BrazeBanner.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ const BrazeBannerWithSatisfiedDependencies = ({
137137

138138
useEffect(() => {
139139
if (hasBeenSeen) {
140-
document.dispatchEvent(new CustomEvent('braze-banner:in-view'));
140+
document.dispatchEvent(
141+
new CustomEvent('banner:open', {
142+
detail: { bannerId: 'braze-banner' },
143+
}),
144+
);
141145
}
142146
}, [hasBeenSeen]);
143147

dotcom-rendering/src/components/marketing/banners/common/BannerWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const withBannerData =
115115
useEffect(() => {
116116
if (hasBeenSeen) {
117117
document.dispatchEvent(
118-
new CustomEvent('banner:in-view', { detail: { bannerId } }),
118+
new CustomEvent('banner:open', { detail: { bannerId } }),
119119
);
120120
}
121121
}, [hasBeenSeen]);

dotcom-rendering/src/components/marketing/epics/ContributionsEpic.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,11 @@ const ContributionsEpic: ReactComponent<EpicProps> = ({
286286
// For epic view count
287287
logEpicView(tracking.abTestName);
288288
document.dispatchEvent(
289-
new CustomEvent('contributions-epic:in-view'),
289+
new CustomEvent('epic:in-view', {
290+
detail: {
291+
epicType: 'contributions',
292+
},
293+
}),
290294
);
291295

292296
// For ophan

dotcom-rendering/src/components/marketing/epics/ContributionsLiveblogEpic.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ export const ContributionsLiveblogEpic: ReactComponent<EpicProps> = ({
158158
if (hasBeenSeen) {
159159
// For epic view count
160160
logEpicView(tracking.abTestName);
161-
document.dispatchEvent(new CustomEvent('liveblog-epic:in-view'));
161+
document.dispatchEvent(
162+
new CustomEvent('epic:in-view', {
163+
detail: {
164+
epicType: 'liveblog-contributions',
165+
},
166+
}),
167+
);
162168

163169
// For ophan
164170
if (submitComponentEvent) {

dotcom-rendering/src/components/marketing/gutters/GutterAskWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const GutterAskWrapper: ReactComponent<GutterProps> = (
7171
useEffect(() => {
7272
if (hasBeenSeen) {
7373
sendOphanEvent('VIEW');
74-
document.dispatchEvent(new CustomEvent('gutter-ask:in-view'));
74+
document.dispatchEvent(new CustomEvent('gutter:in-view'));
7575
}
7676
}, [hasBeenSeen, sendOphanEvent]);
7777

0 commit comments

Comments
 (0)