Question

How do I integrate mixpanel with our Xamarin Forms app?

  • 3 November 2019
  • 6 replies
  • 42 views

Badge

I'd like to use mixpanel to track user events on Android and iOS but our mobile app is coded in Xamarin Forms. Is it possible to accomplish this?



6 replies

Userlevel 4
Badge +4

Hi @EZHIS,

To get the not so great news out of the way, we do not have a direct Xamarin SDK; having said that. We certainly have customers who use Mixpanel with Xamarin. From researching their stories online, we have been able to gather the following regarding how these implementations work.

iOS: Binding iOS with Xamarin works well because you can use the native Mixpanel library. This means if you can compile the iOS Mixpanel code without encountering any fatal errors for usage in Xamarin. You can find some further information regarding how this was done by other users and some Github links with pre-configured implementations here.

Android: I did some research and found some articles (like the one http://forums.xamarin.com/discussion/16945/need-help-with-mixpanel-binding-errors-and-warnings) which show that some users have encountered some frustrations getting our native Android library to work with Xamarin. This is because of the display code within our native Android library which is used to display notifications such as in-app messages and in-app surveys. Due to the way we utilize the native Android API to display these notifications, you can only statically compile this library into a .aar and not a .jar file.

One way you could accomplish this is through our native Java library-- it's pretty bare bones and will only allow you track, meaning it will not allow you to use notifications. However, it looks like you can use this library to compile a .jar file which can be included within your Xamarin project.

One key thing you should consider in this implementation is that the Java library is so bare bones that do not support threading -- you will have to utilize your own thread management in order to use this library.


Badge

I had seen those articles but they are from 5 years ago so I figured they are completely outdated. Do you think the bindings will work for latest version of Xamarin.forms and mixpanel? I don't mind having my programmer implement whatever we need to do but I just don't even know where to start. From what I'm reading we have the option of http api, binding project, or native java library. What are the pros and cons of each of those?


Userlevel 4
Badge +4

@EZHIS I honestly do not know the pros and cons of them, but I completely understand about it being outdated and it being compatible. I am happy to log a product gap on your behalf for our Design and Engineering team to consider creating a direct Xamarin SDK on their roadmap - please let me know if this is something you would like!

In the meantime, as a start point, I did more digging and found a couple more recently updated Github Libraries that use binding.

https://github.com/softlion/mixpanel-xamarin

https://github.com/alxbog/mixpanel-xamarin

Hope this helps you get started!


Badge

Those articles are for xamarin.ios not xamarin.forms. It would be nice I my programmer could communicate with a developer or engineer on your end.


Userlevel 4
Badge +4

@EZHIS Unfortunately, since we currently do not support Xamarin and it is out of our scope, you would need to consult with your developer team. Please let me know if you would like for me to log a product gap on your behalf for our Design and Developer Team to consider creating a direct SDK and providing support for it - glad to submit it on your behalf!


Badge

OK thanks. I'll have my programmer figure it out.


Reply