Enhanced conversions address_info normalization - inconsistent whitespace handling between docs and language samples
Hi,
while implementing Enhanced Conversions with ConversionUploadService.UploadClickConversions, I ran into another documentation inconsistency related to normalization before hashing address_info fields.
This is similar to my previous normalization-related issue:
#1119
1. Whitespace normalization: docs vs language samples
On this Google Ads API documentation page:
https://developers.google.com/google-ads/api/docs/conversions/upload-offline#normalize-and-hash-user-provided-data
the "Normalize and hash user-provided data" section says, paraphrased:
- remove leading and trailing whitespace
- convert text to lowercase
- format phone numbers according to E.164
This appears to imply that internal spaces should remain.
However, the language samples on the same page behave differently:
- Java removes all whitespace with
replaceAll("\\s+", "")
- PHP removes spaces with
str_replace(' ', '', $normalized)
- Perl removes all whitespace with
$value =~ s/\s+//g
- C# uses only
Trim().ToLower()
- Python uses only
strip().lower()
- Ruby uses only
strip.downcase
Documentation page with code examples:
https://developers.google.com/google-ads/api/docs/conversions/upload-offline#code-example
2. Why this matters
For fields like:
hashed_first_name
hashed_last_name
hashed_street_address
the hash changes depending on whether internal spaces are preserved or removed.
Example input:
Depending on the sample, the normalized value before SHA-256 hashing becomes:
or:
These produce different hashes.
3. Question
Which normalization is correct for enhanced conversions uploaded through Google Ads API, especially for UserIdentifier.address_info fields?
Should internal whitespace be preserved, as suggested by the main documentation and by the C# / Python / Ruby samples?
Or should all whitespace be removed, as done by the Java / PHP / Perl samples?
If one behavior is correct, could the documentation and all language samples be aligned?
Thanks.
Enhanced conversions address_info normalization - inconsistent whitespace handling between docs and language samples
Hi,
while implementing Enhanced Conversions with
ConversionUploadService.UploadClickConversions, I ran into another documentation inconsistency related to normalization before hashingaddress_infofields.This is similar to my previous normalization-related issue:
#1119
1. Whitespace normalization: docs vs language samples
On this Google Ads API documentation page:
https://developers.google.com/google-ads/api/docs/conversions/upload-offline#normalize-and-hash-user-provided-data
the "Normalize and hash user-provided data" section says, paraphrased:
This appears to imply that internal spaces should remain.
However, the language samples on the same page behave differently:
replaceAll("\\s+", "")str_replace(' ', '', $normalized)$value =~ s/\s+//gTrim().ToLower()strip().lower()strip.downcaseDocumentation page with code examples:
https://developers.google.com/google-ads/api/docs/conversions/upload-offline#code-example
2. Why this matters
For fields like:
hashed_first_namehashed_last_namehashed_street_addressthe hash changes depending on whether internal spaces are preserved or removed.
Example input:
Depending on the sample, the normalized value before SHA-256 hashing becomes:
or:
These produce different hashes.
3. Question
Which normalization is correct for enhanced conversions uploaded through Google Ads API, especially for
UserIdentifier.address_infofields?Should internal whitespace be preserved, as suggested by the main documentation and by the C# / Python / Ruby samples?
Or should all whitespace be removed, as done by the Java / PHP / Perl samples?
If one behavior is correct, could the documentation and all language samples be aligned?
Thanks.