Skip to content

Enhanced conversions address_info normalization - inconsistent whitespace handling between docs and language samples #1166

Description

@frankii91

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:

ul. Jana Pawła II 10

Depending on the sample, the normalized value before SHA-256 hashing becomes:

ul. jana pawła ii 10

or:

ul.janapawłaii10

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNeed triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions