Hello,
I am trying to track the amount of purchases made through the revenue report that's attached to Mixpanel. Does anyone know how I can track inapp purchases through Mixpanel?
Thanks,
Hannah
Hello,
I am trying to track the amount of purchases made through the revenue report that's attached to Mixpanel. Does anyone know how I can track inapp purchases through Mixpanel?
Thanks,
Hannah
Hi
What I am getting is that you want to capture revenue data to use in the revenue app? In this case, you can use our Android and iOS trackCharge calls for tracking revenue in user profiles. You can check in with your developer to help set this up.
Example code for iOS:
// Tracks $100.77 in revenue for user 13793
[mixpanel.people trackCharge:@(100.77)];
// Refund this user $50
[mixpanel.people trackCharge:@-50];
// Tracks $25 in revenue for this user on the 2nd of
// January
[mixpanel.people trackCharge:@25 withProperties:@{
@"$time": "2020-01-02T00:00:00"
}];
Example code for Java:
MixpanelAPI mixpanel =
MixpanelAPI.getInstance(context, e1655bf900e99202da4652ee3eb4312d);
// Make getPeople() identify has been
// called before making revenue updates
mixpanel.getPeople().identify("13793");
// Tracks $100 in revenue for user 13793
mixpanel.getPeople().trackCharge(100, null);
// Refund this user 50 dollars
mixpanel.getPeople().trackCharge(-50, null);
// Tracks $25 in revenue for user 13793
// on the 2nd of january
JSONObject properties = new JSONObject()
properties.put("$time", "2012-01-02T00:00:00");
mixpanel.getPeople().trackCharge(25, null);
I also wanted to share that we have an article "Send Revenue Data to Mixpanel" from our Archives that also talks as a whole on how to track revenue in Mixpanel that might be useful for your developer team to reference.
Additionally wanted to share that in iOS we capture a common mobile events for in-app purchases (not available in Android). To begin tracking this in iOS, you would need to turn on(instructions here on how to enable them in your project) your common mobile events for iOS.
Hope this helps get you started!
Hello,
Thank you for sending those details over - For the codes does this work for Object-C? Would this track for inapp purchases - as this is the data I need to collect.
I am struggling to get the correct information as the auto track is currently providing me with an inapp purchase every time a user opens the app and not just when the in app purchase has been made.
Thanks,
Hannah
Hi
The iOS example code shared is in Object-C syntax using the special mixpanel.getPeople().trackCharge call to capture revenue data that can be used in the revenue report - it is not for in-app purchases.
If you would like to capture in-app purchases, you can use common mobile events (for iOS only) or your own programmatic code to retrieve in-app billing information and send this data to Mixpanel. Wanted to share apple and android in-apps developer docs as a starting point.
Regarding In-app purchases iOS events being sent in any time your users loads the app is interesting. I am curious if you could share a snapshot of your live view showing this? it is a bit odd to hear that the in-app purchases are running every time a user loads the app and definitely not ideal. Happy to dig further into this.
We typically hear cases where multiple in-app purchases events can be sent in. To give some context on in-apps purchase on iOS, they are generated at the end of purchase, event and event properties are generated when your app accepts the response from the App store that contains the product information after the product request has been sent to the App Store. If there are two responses from the App store, there will be two events generated.
Another case would be if you have common mobile events turned on and your own custom code to track these. In this case we recommend removing one from your app to not cause double events sending in.
I’ll be here for more information on the in-app purchase events on the iOS end!
Hello Stephanie,
Thank you for your quick response. I will send those details onto my developer.
I have attached my live view and then attached a screenshot of what my profile looks like on the app - Every day I get a new In-App purchase (but our purchases are monthly).
Thanks,
Hannah
Hello Mixpanel
I would like to discuss with some from from your team - Are we able to track in app purchases (automatically renewing subscriptions) in Mixpanel?
Best,
Hannah
Hello
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.