From bf355c0030f88256dd7b48a672f958d6d258ef20 Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Tue, 2 Jun 2026 12:41:09 +0000 Subject: [PATCH 1/2] Update formatter to handle Google domain email addresses --- src/Google/Ads/DataManagerUtil/Formatter.php | 3 +++ tests/Google/Ads/DataManagerUtil/FormatterTest.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Google/Ads/DataManagerUtil/Formatter.php b/src/Google/Ads/DataManagerUtil/Formatter.php index 8a5d098..6a9e75d 100644 --- a/src/Google/Ads/DataManagerUtil/Formatter.php +++ b/src/Google/Ads/DataManagerUtil/Formatter.php @@ -59,6 +59,9 @@ public function formatEmailAddress(string $email): string // "Create variations of your email address" at: // https://support.google.com/a/users/answer/9282734 + // Removes plus sign (+) and all characters that follow it. + $user = explode('+', $user)[0]; + // Removes all periods (.). $user = str_replace('.', '', $user); if (strlen($user) === 0) { diff --git a/tests/Google/Ads/DataManagerUtil/FormatterTest.php b/tests/Google/Ads/DataManagerUtil/FormatterTest.php index 7d44427..e9ed4ba 100644 --- a/tests/Google/Ads/DataManagerUtil/FormatterTest.php +++ b/tests/Google/Ads/DataManagerUtil/FormatterTest.php @@ -45,6 +45,9 @@ public static function validEmailAddressProvider(): array 'case normalized domain' => ['QuinnY@EXAMPLE.com', 'quinny@example.com'], 'periods stripped from gmail.com' => ['Jefferson.Loves.hiking@gmail.com', 'jeffersonloveshiking@gmail.com'], 'periods stripped from googlemail.com' => ['Jefferson.LOVES.Hiking@googlemail.com', 'jeffersonloveshiking@googlemail.com'], + 'plus signs not stripped from non-google' => ['user.name+NYC@Example.com', 'user.name+nyc@example.com'], + 'plus signs stripped from gmail.com' => ['Cloudy.SanFrancisco+shopping@gmail.com', 'cloudysanfrancisco@gmail.com'], + 'plus signs stripped from googlemail.com' => ['Cloudy.SanFrancisco+shopping@googlemail.com', 'cloudysanfrancisco@googlemail.com'], ]; } From 5bde7738920a5ccd783702b51aef3d8049ba0402 Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Tue, 2 Jun 2026 14:10:09 +0000 Subject: [PATCH 2/2] Bump version of util library --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 92c3f21..487cd66 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "googleads/data-manager-util", "description": "Utilities and code samples for working with the Data Manager API and PHP.", "type": "library", - "version": "0.1.0", + "version": "0.2.0", "license": "Apache-2.0", "autoload": { "psr-4": {