-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
How to pass item value and quantity to analytics? #4578
Comments
I have the same issue. They added the "quantity" field in the version 10.1.1 but still there is no any price related fields. |
@PlatonSotnykov "they" was @Danchoys generously advancing the state of react-native-firebase for himself and everyone in #4536 - if you require price-related fields, please examine that PR (to see roughly how it's done) and propose a PR! I'll happily work with you to merge it |
Hello! I want to display |
Hi, @brerdem ! I think your issue is that you copied this code when adding the new price parameter:
It was meant to fix the problem of quantity being passed as floating point, which obviously doesn't apply to prices, that are supposed to be such. In fact I think in your case it is enough to update |
I have the same problem. Using the version I have modified the structs.js and index.d.ts files to add the price (and also the currency), but the currency doesn't even appear in the item's properties. |
@aalmodovarr Hi! I have investigated this issue further and set up a native iOS project (using the latest SDK of 7.5.0) with this code: - (IBAction)sendEvent:(id)sender {
NSMutableDictionary *jeggings = [@{
kFIRParameterItemID: @"SKU_123",
kFIRParameterItemName: @"jeggings",
kFIRParameterItemCategory: @"pants",
kFIRParameterItemVariant: @"black",
kFIRParameterItemBrand: @"Google",
kFIRParameterPrice: @9.99,
} mutableCopy];
jeggings[kFIRParameterQuantity] = @2;
NSMutableDictionary *itemDetails = [@{
kFIRParameterCurrency: @"USD",
kFIRParameterValue: @19.98
} mutableCopy];
itemDetails[kFIRParameterItems] = @[jeggings];
[FIRAnalytics logEventWithName:kFIREventAddToCart parameters:itemDetails];
} While 100% legit, it still results in the following: This makes me believe that this is an internal Firebase problem, and this issue has to be reported there. Update It also doesn't seem to be an SDK issue, rather it is either processed or displayed badly as native logs show things as expected:
|
One person's "problem" is another person's "avoid IEEE Floating Point errors when dealing with monetary values at all costs by internally using an integer with enough significant digits to carry any sub-currency-unit partial amounts" Just sayin' :-) |
Thanks @Danchoys for the clarification, it's appreciated! |
Hi, I unable to pass the value and quantity of item with the code:
await analytics().logEvent('purchase', {
value: parseFloat(amount),
currency: 'USD',
items: [
{
item_name: PRODUCT_NAME,
item_category: ITEM_CATEGORY,
price: parseFloat(amount),
quantity: 1
},
],
});
May I know any missing code from my part?
The text was updated successfully, but these errors were encountered: