-
Notifications
You must be signed in to change notification settings - Fork 255
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
[Google Ads] Send non-American country codes correctly #2688
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2688 +/- ##
==========================================
- Coverage 78.52% 78.46% -0.06%
==========================================
Files 1032 1033 +1
Lines 18632 18704 +72
Branches 3530 3549 +19
==========================================
+ Hits 14630 14677 +47
- Misses 2823 2837 +14
- Partials 1179 1190 +11 ☔ View full report in Codecov by Sentry. |
… numbers. The other country code field is for use with addresses
const formatPhone = (phone: string): string => { | ||
const formattedPhone = formatToE164(phone, '1') | ||
const formatPhone = (phone: string, countryCode?: string): string => { | ||
const formattedPhone = formatToE164(phone, countryCode ?? '+1') |
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.
Nice, keeping that original default so we don't break current implementations that may depend on it.
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.
Thank you for making this enhancement! Great work with the variety of test cases!
At the moment Google Ads will always automatically prepend phone numbers with '+1'. This behavior is documented in this ticket: https://segment.atlassian.net/browse/STRATCONN-5386
This PR updates the phone number formatting logic to use the new
phone_country_code
field when formatting a phone number. This field is distinct from the existingcountry_code
field, which expects non-numeric values such as 'US'.Testing
Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.
Tested successfully in local + staging.
Local Test: The phone number is correctly formatted as
payload.phone_country_code + payload.phone
.This value is hashed before sending so manually console.logging it before that:
Stage Test
Syncs continue to succeed after the new country code field is introduced and mapped to: