From 322cf4cf718467d4ec52e4c3e66b4db4dec197ad Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 8 Dec 2025 23:06:44 +0100 Subject: [PATCH 1/2] Also replace "+" characters when normalizing email --- .../upload_enhanced_conversions_for_leads.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/remarketing/upload_enhanced_conversions_for_leads.py b/examples/remarketing/upload_enhanced_conversions_for_leads.py index a32c813a0..a8856bde5 100644 --- a/examples/remarketing/upload_enhanced_conversions_for_leads.py +++ b/examples/remarketing/upload_enhanced_conversions_for_leads.py @@ -254,14 +254,10 @@ def normalize_and_hash_email_address(email_address: str) -> str: # Check that there are at least two segments if len(email_parts) > 1: - # Checks whether the domain of the email address is either "gmail.com" - # or "googlemail.com". If this regex does not match then this statement - # will evaluate to None. - if re.match(r"^(gmail|googlemail)\.com$", email_parts[1]): - # Removes any '.' characters from the portion of the email address - # before the domain if the domain is gmail.com or googlemail.com. - email_parts[0] = email_parts[0].replace(".", "") - normalized_email = "@".join(email_parts) + # Removes any '.' and '+' characters from the portion of the email address + # before the domain + email_parts[0] = email_parts[0].replace(".", "").replace("+","") + normalized_email = "@".join(email_parts) return normalize_and_hash(normalized_email) From b86b285cdebd93a26f96213c28178be8ba6363ca Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 8 Dec 2025 23:08:49 +0100 Subject: [PATCH 2/2] Copy changes to other example too --- .../upload_enhanced_conversions_for_web.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/remarketing/upload_enhanced_conversions_for_web.py b/examples/remarketing/upload_enhanced_conversions_for_web.py index edc4260e4..07895c9a8 100644 --- a/examples/remarketing/upload_enhanced_conversions_for_web.py +++ b/examples/remarketing/upload_enhanced_conversions_for_web.py @@ -233,14 +233,10 @@ def normalize_and_hash_email_address(email_address): # Check that there are at least two segments if len(email_parts) > 1: - # Checks whether the domain of the email address is either "gmail.com" - # or "googlemail.com". If this regex does not match then this statement - # will evaluate to None. - if re.match(r"^(gmail|googlemail)\.com$", email_parts[1]): - # Removes any '.' characters from the portion of the email address - # before the domain if the domain is gmail.com or googlemail.com. - email_parts[0] = email_parts[0].replace(".", "") - normalized_email = "@".join(email_parts) + # Removes any '.' and '+' characters from the portion of the email address + # before the domain + email_parts[0] = email_parts[0].replace(".", "").replace("+","") + normalized_email = "@".join(email_parts) return normalize_and_hash(normalized_email)