react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

logPurchase event doesn't add price value to analytics

Open DmitriyKulikovskiy opened this issue 1 year ago • 5 comments

I have installed this library with version:

"@react-native-firebase/analytics": "^15.1.1",
"@react-native-firebase/app": "^15.1.1"

for my react-native project with version: "react-native": "^0.63.3"

When I use logPurchase event it firebase table price always is 0. I also tried to add hardcoded value but it also doesnt't work. But I see that quantity value was added, also I've tried other event, for example logViewItem event or logAddToCart event and they work correct. So I guess It means that everything is correct. But the issue in only with price value.

Example of my code:

	async sendPurchaseAnalytics() {
		await analytics().logPurchase({
			value: 150,
			currency: 'euro',
			tax: 25,
			items: order?.products.map(product => {
				return {
					item_brand: 'bran example',
					item_id: 'id-1',
					item_name: 't-shirt',
					price: 25,
					quantity: 1,
				}
			})
		}); 
	}

So how to fix it? Because I didn't find any solution which can help me.

DmitriyKulikovskiy avatar Sep 01 '22 10:09 DmitriyKulikovskiy

Have you seen the issues list related? https://github.com/invertase/react-native-firebase/issues?q=is%3Aissue+analytics+price+is%3Aclosed+sort%3Aupdated-desc

It appears this was added, but debug view may not show item attributes, or show them slowly. Does it show up in regular analytics reports after processing?

Other than that, unsure - a lot of people are understandably interested in this, but nothing has changed in the area in quite a long time and no one else is complaining about it which I find suspicious - normally we would get a lot of complaints if it was broken.

In general though, you've deleted the issue template so I'm going to have to close this, I really can't help without the information required to help, have empathy with your troubleshooters

https://stackoverflow.com/help/how-to-ask

mikehardy avatar Sep 01 '22 12:09 mikehardy

Have you seen the issues list related? https://github.com/invertase/react-native-firebase/issues?q=is%3Aissue+analytics+price+is%3Aclosed+sort%3Aupdated-desc

It appears this was added, but debug view may not show item attributes, or show them slowly. Does it show up in regular analytics reports after processing?

Other than that, unsure - a lot of people are understandably interested in this, but nothing has changed in the area in quite a long time and no one else is complaining about it which I find suspicious - normally we would get a lot of complaints if it was broken.

In general though, you've deleted the issue template so I'm going to have to close this, I really can't help without the information required to help, have empathy with your troubleshooters

https://stackoverflow.com/help/how-to-ask

I don't see it analytics reports in item revenue column (it always is 0.00), but quantity value was added.

DmitriyKulikovskiy avatar Sep 01 '22 14:09 DmitriyKulikovskiy

I wonder if this is a formatting issue 🤔 - not seeing it in the analytics report is an unexpected result

mikehardy avatar Sep 02 '22 00:09 mikehardy

I won't have time to look into this personally, apologies, but the general path I take to look at things like this is multi-pronged, depending on how much success I'm having I use one or all of the above:

  • make a native reproducer based on one of the quickstarts from native
    • https://github.com/firebase/quickstart-android/tree/master/analytics
    • https://github.com/firebase/quickstart-ios/tree/master/analytics

See how things are logged there, basically prove it's possible (if not, now you have a reproducer for the underlying system)

  • add logging in the javascript here in this module before/after the native module call, and in the native module before/after the call to the underlying SDK, make sure things look good before/after, and match what you would expect from the above quickstart or the native documentation

mikehardy avatar Sep 02 '22 00:09 mikehardy

Currency should be a 3 letter iso currency (it's in the doc I think), not "euro". That's probably why the price is not taken into account

Minishlink avatar Sep 08 '22 15:09 Minishlink