Problem with the implemention push notifications using mixpanel

I’m trying to implement an app that will use two features of the mixpanel:

  1. Track activity and analytics
  2. Work with push notifications (creating/tracking)

For first task I’m using [angular-mixpanel][1] module and it works perfectly. But I cant use the same module for the second task because this module has no methods needed for push notifications. First I want connect push notifications for Android. [Mixpanel guide for Android][2] contains sample of code to handle registration:

public void registerPush(GoogleCloudMessaging gcm){
    String registrationId = gcm.register("YOUR_SENDER_ID");
    MixpanelAPI.People people = mMixpanel.getPeople();
    people.identify("USER_DISTINCT_ID");
    people.setPushRegistrationId(registrationId);
}


I found only two plugins which can regiser token for push notifications (`people.setPushRegistrationId()`):

 - [cordova-mixpanel][3]
  this one looks good but lacks Android support.
 - [cordova-mixpanel-plugin][4]
  this plugin has the method `window.mixpanel.people.setPushId()` but I it doesn't works. I tried send push notifications  to my device using mixpanel account, but I get no any result.

I'm sure what I used correctly all data (Google Cloud Messaging token, mixpanel app token and etc.) because tracking activity works correctly and I see data in the mixpanel. I think my device can't register in the mixpanel for notifications. I don't know how I can check it.

What do you think about it? Has someone solved the similar problem? 

I will be glad of any information. If you have something you'd like to share, please send me an email at martynov.max.dunice@gmail.com 

Thanks in advance!
Max


  [1]: https://github.com/kuhnza/angular-mixpanel
  [2]: https://mixpanel.com/help/reference/android-push-notifications
  [3]: https://github.com/poetic/cordova-mixpanel
  [4]: https://github.com/samzilverberg/cordova-mixpanel-plugin

Hi,

First, I am using mixpanel alone, with the javascript SDK (it is working well )

But, I am not using the push system of mixpanel, nevertheless I guess you can use the cordova push plugin, and once you get the token of the device, you can call the setPushRegistrationId of mixpanel?

Hope this help.

Do you mean https://github.com/phonegap/phonegap-plugin-push ?

Yes. You can wait the

push.on(‘registration’, function(data) {
// data.registrationId
});

and set the user on mixpanel

The solution.

My goal was using mixpanel module manage notifications. I wrote above which problems I have received.

In result I decided to use phonegap-plugin-push (https://github.com/phonegap/phonegap-plugin-push). It best to use it because:

  1. You can find more information about almost all problems of this plugin
  2. I have created a separated angular service which works only with notifications. And I used this service in many my projects.

Conclusion: for every task try to use a special tools. For analytics - a plugin for analytics, for notifications - a plugin for push notifications. And then you will have less problems.

Good luck

2 Likes