ConversionsAPI-Tag-for-GoogleTagManager icon indicating copy to clipboard operation
ConversionsAPI-Tag-for-GoogleTagManager copied to clipboard

fix user_data.email_address ==> user_data.email

Open igor-trkkn opened this issue 1 year ago • 5 comments

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

igor-trkkn avatar Dec 05 '23 12:12 igor-trkkn

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);

koconnor3 avatar Dec 05 '23 14:12 koconnor3

@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

igor-trkkn avatar Dec 05 '23 15:12 igor-trkkn

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

koconnor3 avatar Dec 05 '23 15:12 koconnor3

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 avatar Dec 05 '23 16:12 igor-trkkn

Hello...? Anyone at Meta?

igor-trkkn avatar Aug 13 '24 13:08 igor-trkkn