-
Notifications
You must be signed in to change notification settings - Fork 0
[codex] Capture VTEX newsletter opt-in #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| const extractUserData = (orderForm) => { | ||
| const profile = orderForm?.clientProfileData || {}; | ||
| const preferences = orderForm?.clientPreferencesData || {}; | ||
|
|
||
| return { | ||
| const user = { | ||
| id: profile.email, | ||
| email: profile.email, | ||
| first_name: profile.firstName, | ||
|
|
@@ -10,6 +11,12 @@ const extractUserData = (orderForm) => { | |
| document: profile.document, | ||
| source: "vtex", | ||
| }; | ||
|
|
||
| if (preferences.optinNewsLetter === true) { | ||
| user.subscription_state = true; | ||
| } | ||
|
|
||
| return user; | ||
| }; | ||
|
|
||
| const extractOrderData = (orderForm) => { | ||
|
|
@@ -75,8 +82,7 @@ const extractOrderData = (orderForm) => { | |
|
|
||
| return { | ||
| reference: orderForm.orderGroup || orderForm.orderFormId, | ||
| amount: orderForm.value || 0, | ||
| currency: storeData.currencyCode, | ||
| source: "vtex", | ||
| delivery, | ||
| items, | ||
|
Comment on lines
83
to
87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Both Useful? React with 👍 / 👎. |
||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the shopper enters an email/phone before checking the newsletter box, the first funnel update identifies that same user without
subscription_state; the later update reaches this new branch, but the bundled Hellotext SDK indist/funnel.jsreturns early fromidentifywhen the rememberedhello_user_idalready matches the id, so this added field is never posted. This makes the common “enter identity, then opt in” flow fail to capture the opt-in unless the code forces a non-deduped update path.Useful? React with 👍 / 👎.