From df30e669d8423b405764eb117a955e93b92a47b7 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Wed, 9 Oct 2024 13:16:32 +1300 Subject: [PATCH] Don't retrieve and use email from cookie if storing not enabled Because of the issue fixed in 7140d1a3f2e8d724f2efb732b01fd38dd479557d, 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. --- template.js | 2 +- template.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template.js b/template.js index 717d35e..ac9f55d 100644 --- a/template.js +++ b/template.js @@ -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]; } diff --git a/template.tpl b/template.tpl index 1edc038..1060b07 100644 --- a/template.tpl +++ b/template.tpl @@ -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]; }