According to this https://support.google.com/firebase/answer/6317485?hl=en in_app_purchase event will be automatically tracked when a user completes an in-app purchase.
The problem occurs with test users. They are not charged (since they are entered in "Test Accounts" list in google developer console) but in_app_purchase events are tracked for them too. So, there are discrepancies between analytics and real payments.
Is there a way to separate somehow real and 'test' purchases?
Either, maybe a way to disable automatically tracking for certain events and send them manually? And how to recognize 'test' purchases in this case at runtime (in order to don't send in_app_purchase event)
I know it's a bit late, but putting down my 2-cents here:
I think you might already know that test purchases for Android in Firebase Analytics are accounted for, as mentioned here(see in_app_purchases), "Note: paid app-purchase revenue, subscription revenue (Android only), and refunds are not automatically tracked. Your reported revenue may differ from the values you see in the Google Play Developer Console. Events that are flagged as being invalid or as sandbox (test) are ignored. Only iOS events are flagged as sandbox".
That said, there isn't a way to recognize such purchases at runtime and avoid them from being reported for Android and populating your prod app data. However, there are only a couple of ways to deal with it currently(in my opinion):
Although, I would consider option #2 a little counter-intuitive given your case and go with #1 instead.
Disabling reporting of test purchase data to Analytics at runtime would require 2 things:
In this case, #2 definitely does not seem like an option currently. Hence, all we can do here is reach out to Firebase Support and request that feature. But until then, I don't see another way. But I'm curious and open to suggestions if somebody else has. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With