Skip to content

Commit

Permalink
Don't retrieve and use email from cookie if storing not enabled
Browse files Browse the repository at this point in the history
Because of the issue fixed in 7140d1a,
many people will have cookies with this email set. If they then update
to a fixed version and leave this field disabled they may believe email
is *not* being sent to Klaviyo when it may indeed be, even if not
included in event properties.

By only retriving the email from cookie when storing the cookie is
enabled, we sidestep this issue.
  • Loading branch information
bagedevimo committed Oct 9, 2024
1 parent eae1d59 commit df30e66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion template.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function getCustomerProperties() {

if (data.email) customerProperties.email = data.email;
else if (eventData.email) customerProperties.email = eventData.email;
else {
else if (data.storeEmail) {
let emailCookie = getCookieValues('stape_klaviyo_email');
if (emailCookie.length) customerProperties.email = emailCookie[0];
}
Expand Down
2 changes: 1 addition & 1 deletion template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ function getCustomerProperties() {

if (data.email) customerProperties.email = data.email;
else if (eventData.email) customerProperties.email = eventData.email;
else {
else if (data.storeEmail) {
let emailCookie = getCookieValues('stape_klaviyo_email');
if (emailCookie.length) customerProperties.email = emailCookie[0];
}
Expand Down

0 comments on commit df30e66

Please sign in to comment.