Skip to content

Commit 2942fac

Browse files
authored
Add data-ph- elements to CTA buttons (#1821)
1 parent a9ef1ba commit 2942fac

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

frontends/ol-components/src/components/LearningResourceExpanded/LearningResourceExpandedV1.test.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ describe("Learning Resource Expanded", () => {
104104
}) as HTMLAnchorElement
105105

106106
expect(link.href).toMatch(new RegExp(`^${resource.url}/?$`))
107+
expect(link.getAttribute("data-ph-action")).toBe("click-cta")
107108
}
108109
},
109110
)

frontends/ol-components/src/components/LearningResourceExpanded/LearningResourceExpandedV1.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ const CallToActionSection = ({
244244
<StyledLink
245245
target="_blank"
246246
size="medium"
247+
data-ph-action="click-cta"
248+
data-ph-offered-by={offeredBy?.code}
249+
data-ph-resource-type={resource.resource_type}
250+
data-ph-resource-id={resource.id}
247251
endIcon={<RiExternalLinkLine />}
248252
href={getCallToActionUrl(resource) || ""}
249253
>

frontends/ol-components/src/components/LearningResourceExpanded/LearningResourceExpandedV2.test.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ describe("Learning Resource Expanded", () => {
105105
}) as HTMLAnchorElement
106106

107107
expect(link.href).toMatch(new RegExp(`^${resource.url}/?$`))
108+
expect(link.getAttribute("data-ph-action")).toBe("click-cta")
108109
}
109110
},
110111
)

frontends/ol-components/src/components/LearningResourceExpanded/LearningResourceExpandedV2.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ const CallToActionSection = ({
355355
<StyledLink
356356
target="_blank"
357357
size="medium"
358+
data-ph-action="click-cta"
359+
data-ph-offered-by={offeredBy?.code}
360+
data-ph-resource-type={resource.resource_type}
361+
data-ph-resource-id={resource.id}
358362
endIcon={<RiExternalLinkLine />}
359363
href={getCallToActionUrl(resource) || ""}
360364
>

0 commit comments

Comments
 (0)