Mixpanel offers both web and mobile app analytics solution. The strong points for this tool are real-time data, funnel analysis, in-depth analysis to track retention.
Measuring what your users are doing on your application is an important part of the product building process. Because this metrics helps to build an efficient mobile marketing strategy and also know which parts of your app drive valuable conversions.
For using Mixpanel into your application first create an application in your Mixpanel account. Now you got a token using that token only you can connect that Mixpanel application to your mobile application.
After working on the same for many times I thought why not this be done with a single util class. So here it is, my post talking about how to track events with Mixpanel.
MixpanelHelper which is the utility class contains the set of utility methods to connect Mixpanel app and track events.For implementing this just create an instance of that utility class and call the corresponding method with the needed parameter.
Here events are identified with the name so event name is mandatory and you can send custom attributes for that particular event with the help of JSON object. For adding custom attributes just create a JSONobject and put all the values into it and the pass this object as a parameter.
|//Track event with name|
|//Add custom attributes with the events|
|JSONObject props=new JSONObject();|
This util class is available as a Gist over on GitHub if you want to check it out.View Gist
Feel free to comment and share, keep watching this space get more updates on Android Stuff!
Latest posts by Jaison Fernando (see all)
- How to create a barcode scanner using Firebase MLKit? - November 9, 2018
- How to update your app using Firebase Remote Config? - October 20, 2018
- How to add In-App Purchase in your Android app? - September 28, 2018