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

fix user_data.email_address ==> user_data.email #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

igor-trkkn
Copy link

Adjusts an email key name in the user_data object according to the schema of the Google Analytics 4 user-provided data.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 5, 2023
@koconnor3
Copy link

perhaps to avoid breaking changes we should support both variants? e.g.
(eventModel.user_data != null ? hashFunction(eventModel.user_data.email || eventModel.user_data.email_address) : undefined);

@igor-trkkn
Copy link
Author

igor-trkkn commented Dec 5, 2023

@koconnor3, I am not convinced it is needed, as user_data.email_address has not existed as far as I remember. The user data object is a product of the user-provided data feature and is a built-in feature in gtag library. email is the valid key. I doubt users could pass JSON themselves with the own version of keys in the GA4 events.
image

@koconnor3
Copy link

koconnor3 commented Dec 5, 2023

as a matter of fact, before the 'User-Provided Data' variable type existed in Google Tag Manager (and some even now) I have seen many clients pass JSON directly the user_data event parameter in a GA4 event and it be used thus.

Google's common event data for Server GTM docs lists user_data.email_address instead of user_data.email:
https://developers.google.com/tag-platform/tag-manager/server-side/common-event-data
image

@igor-trkkn
Copy link
Author

That's absolutely true, but here are few points to address.

I think Google needs to sort out their docs 😄 because next to some entries in the table, there is a link to the support docs where email is the only recognized key 🤷‍♂️
https://support.google.com/google-ads/answer/13262500

If you try to send email_address, it won't be picked up by the library.

It is indeed, plausible that users may have defined anyhow their version of user data in the past, however, currently the user_data can be only used exclusively following the gtag protocol. It won't transmit unrecognised keys anyway. I guess, an official API of the gtag, on which the template is based on, ought to take precedence over the custom solutions. At the end, sometimes a need to adapt to the latest changes is inevitable.

Lets hear from the core team of the repo ;) But in general, I think the earlier updates of the gtag and GTM, should have already forced some users to make adjustments in regard to user data, hence it is safe not to stuff the template with extra code.

@igor-trkkn
Copy link
Author

Hello...? Anyone at Meta?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants