-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow unknown product keys for product details #5
base: main
Are you sure you want to change the base?
Conversation
If we're able to send nested categories to GA4, but other tools only accept a single category, what do you think of allowing sending Use case: You have a 3-level hierarchy: This isn't in the PR, currently as I wanted to see what you thought given this has potential implications for all ecommerce tools. |
hey @wuservices ! I'm concerned that this change is actually not about extending the GA4 component per se, but rather, it is extending the Ecommerce API. Allowing keys like Nothing generally prevents you from adding custom keys to the payload when calling Does that make sense? |
Hi @bjesus thanks for taking a look. I agree this could be a bigger discussion if thinking about extending the Ecommerce API completely, especially because nested categories is a feature that most APIs will lack and it's also something that each provider is likely to have a slightly different model for. However, I think the idea of adding custom keys is a general need here and would be a good strategy to handle in general. My understanding of the current code is that One concern with adding custom keys for each item and blindly mapping them to each tool is that some tools may not like the extra keys (hypothetically at least). Would it be helpful to namespace additional custom keys and have a way to pass them in both at the root and for any products array? zaraz.ecommerce('Product List Viewed', {
products: [
{
product_id: '999555321',
sku: '2671033',
name: 'V-neck T-shirt',
brand: 'Cool Brand',
variant: 'White',
price: 14.99,
currency: 'usd',
value: 18.99,
position: 1,
category: 'T-shirts',
_ga4_ca2: 'polo',
}
]
}) |
Hey @wuservices, |
@bjesus I think accepting unknown keys for product data would be pretty flexible. It also seems like it'd simplify the code a bit. I updated the PR with what I think this would look like. |
@bjesus just checking in here. Do the updated changes look like what you had in mind? Happy to tweak if needed. Thanks! |
@bjesus @simonabadoiu how does the proposed change look? The idea is that there is no longer an allowlist for |
Allows unknown (to Zaraz e-commerce) keys that could be valid for GA4, such as `'ca2'`, `'ca3'`, `'ca4'`, `'ca5'`, `'ds'`, `'af'`, `'lp'` to be added to the GA4 result.
Removes product details mapping, which is unnecessary now that unknown keys are accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, the code looks good to me. We're just making sure it makes sense when it comes to the MC standard and we should be good to go
@bjesus does this look good? It seems like this will also allow users to add custom item-scoped custom parameters too. |
Adds additional item parameter mappings for GA4 ecommerce including category2-5, which fixes #3.
Parameters from: https://www.thyngster.com/ga4-measurement-protocol-cheatsheet/