Skip to content

Commit

Permalink
Merge pull request #762 from Financial-Times/ENTST-790-update-as-tool…
Browse files Browse the repository at this point in the history
…tip-logic

Add Advance Sharing first use event dispatch
  • Loading branch information
asugar13 authored Jan 25, 2024
2 parents dc7983c + 5bd986e commit fe6b780
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/x-gift-article/src/GiftArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ const withGiftFormActions = withActions(

if (redemptionUrl) {
tracking.createESLink(redemptionUrl)

const sharesCount = document.cookie.match(new RegExp(`(^| )ES_COUNT=([^;]+)`))?.at(2)
if (Number(sharesCount) === 1) {
const firstUseEvent = new Event('advanced-sharing-first-use')
document.dispatchEvent(firstUseEvent)
}

return updaters.setGiftUrl(redemptionUrl, redemptionLimit, false, true)(state)
} else {
return updaters.setErrorState(true)
Expand Down

0 comments on commit fe6b780

Please sign in to comment.