Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nick-Ag
Copy link
Member

@nick-Ag nick-Ag commented Jan 16, 2025

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 existing country_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:
Screenshot 2025-01-17 at 11 33 37 AM

Stage Test
Syncs continue to succeed after the new country code field is introduced and mapped to:
Screenshot 2025-01-16 at 8 20 37 PM

Screenshot 2025-01-16 at 8 20 15 PM
  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [If destination is already live] Tested for backward compatibility of destination. Note: New required fields are a breaking change.
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.46%. Comparing base (f26d68d) to head (eb13005).
Report is 7 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@nick-Ag nick-Ag changed the title [wip dont review] [Google Ads] Can pass in non american country codes [wip dont review] [Google Ads] Send non-American country codes correctly Jan 16, 2025
… numbers. The other country code field is for use with addresses
@nick-Ag nick-Ag changed the title [wip dont review] [Google Ads] Send non-American country codes correctly [Google Ads] Send non-American country codes correctly Jan 17, 2025
@nick-Ag nick-Ag marked this pull request as ready for review January 17, 2025 19:36
@nick-Ag nick-Ag requested a review from a team as a code owner January 17, 2025 19:36
const formatPhone = (phone: string): string => {
const formattedPhone = formatToE164(phone, '1')
const formatPhone = (phone: string, countryCode?: string): string => {
const formattedPhone = formatToE164(phone, countryCode ?? '+1')
Copy link
Contributor

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.

Copy link
Contributor

@maryamsharif maryamsharif left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants