We recently upgraded the Android Google Play version of our app with newest Unity IAP and added the new Unity Analytics package. We’re still using Legacy Analytics to send events for now, but the package is installed because Legacy (Analytics Library) now includes it as a dependency. The version upgrade is as follows:
We know that Unity IAP logs all the IAP transaction events automatically, so we’ve never done this ourselves in the code.
The problem is that in the dashboard, the new analytics used to show the same revenue as the legacy dashboard. However, with this app update, the new analytics dashboard shows a huge (and incorrect) jump in revenue (like a factor of 7-10 times). After some investigation, this appears to be due to it showing unverified revenue. Showing unverified revenue in legacy dashboard seems to match what new Analytics shows by default. So naturally I thought that the Google Play private key must not be set up correctly for the new analytics service.
However, after following the instructions here, everything appears to be set up correctly:
And with the new analytics dashboard, there’s no way that I can tell to filter by verified or unverified revenue.
Thanks for sharing the details of your issue. I will take a look at your data and try and find out what is going on.
I’ll get back to you if I need any further information
Thanks @Laurie-Unity . We recently found a new IAP-related bug with our build release that we’ve just fixed today where the ProcessPurchase was always returning PurchaseProcessingResult.Pending. This means that user’s would have their in-app-purchases refunded by Google Play after 3 days and their purchases were never being ingested by the game. This probably caused users to attempt a purchase multiple times. However, this may not account for the problem mentioned in my original post because it doesn’t make sense to us that Unity IAP or Analytics should be recording transaction events for purchases that are not marked completed by the game code. If this revenue data is instead obtained solely from Google Play Store API (using the private key) then it seems like Analytics may not be taking into account Refunds. Also that wouldn’t account for the differences seen between legacy and new analytics graphs.
Thanks and I hope this additional information helps.
Thanks for the additional information, your explanation matches exactly what I have seen in your data and I can explain what is happening.
Your revenue reporting increases dramatically from 22nd March when you released v1.11.22 of your game containing IAP SDK 4.7.0. The issue you have identified, with the ProcessPurchase always returning PurchaseProcessingResult.Pending results in the IAP SDK attempting to process the purchase again at the start of the next session as the IAP SDK is Initialized. Whilst the purchase remains in the Pending state the SDK will continue to attempt to process it. This is resulting in duplicate transaction events being recorded.
This can be seen clearly in your data if you look at individual users with multiple transaction events containing validated revenue for the same transactionID, with the repeat transactions occurring within 6-7 seconds of the game launching and generating a gameStarted event and fresh sessionID
If you try running this query in your Analytics SQL Data Explorer, you’ll see what I mean.
select event_name
, event_timestamp
, event_json:sessionID sessionID
, event_json:revenueValidated revenueValidated
, event_json:convertedProductAmount convertedProductAmount
, event_json:productID productID
, event_json:transactionID transactionID
from events
where user_id = '504e903c29645305c928f0fd917f618a'
and event_date >= '2023-03-22'
and event_name in ('gameStarted', 'transaction')
order by event_id;
If you are now returning PurchaseProcessingResult.Complete on your ProcessPurchase method, it should prevent the repeat attempts at the start of subsequent sessions.
However, you are right to be confused by the transaction events being recorded whilst the transaction is still pending. The engineering team are aware of this issue and we are investigating options to resolve it.
Hello tessellation,
We will be making changes to when the transaction event is being sent to Analytics.
It will be sent when the transaction has been acknowledged rather than the moment it reaches the ProcessPurchase to avoid counting pending transactions.