Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixpanel messaging support . #91

Open
scdyn opened this issue Jun 19, 2018 · 11 comments
Open

Mixpanel messaging support . #91

scdyn opened this issue Jun 19, 2018 · 11 comments

Comments

@scdyn
Copy link

scdyn commented Jun 19, 2018

Besides event tracking and analytics, Mixpanel allows for InApp messaging and push notifications.

The entry point of their SDK to such features are MixpanelAPI.getPeople().getNotificationIfAvailable() and .initPushHandling()

AFAIK, the cordova-mixpanel-plugin doesn't support these, meaning that the plugin doesn't support messaging yet.
Am I wrong ? Any plan regarding messaging support ?

@samzilverberg
Copy link
Owner

samzilverberg commented Jul 15, 2018

hi @scdyn , sry for the delayed message. I missed the email notification for this issue.
You're right that the plugin doesn't support this yet.

To let the app receive notifs, for android for example, a GCMReceiver needs to be defined in the android manifest (see example here and here) .

I deliberately avoided implementing this because this doesn't play well nice with the more common way of handling push notifs aka PhoneGap Push Plugin.
I don't remember exactly the details, but i remember either both receivers get the notifs or just one of them, causing unexpected behavior.

cordova and plugin.xml have evolved a bit since a couple of years ago so maybe we can find a nice conditional way to implement this and make it optional via some plugin installation flag.

I'll try looking into it but dont see it being in the codebase anytime in next month or two.

other than that, I checked the mixpanel reference for in-app messages at:

looks like ios&android work a little differently, which would mean more effort needed to integrate this...

@SpellChucker
Copy link
Contributor

FYI, iPhone works great with both in-app and push notifications here in conjunction with the PhoneGap Push Plugin. I am having issues with Android and I think it might be related to not calling initPushHandling. We don't have a way of calling that via this plugin. Maybe we can add that method? It takes the SENDER_ID as a parameter.

Other than that, it should just be setting up the permissions and such but I have not tried it yet. I will come back here if I have any success.

@SpellChucker
Copy link
Contributor

I was able to get push notifications working for android by adding in the required configuration into AndroidManifest.xml as well as calling initPushHandling for Android. I've created this PR to allow users to call initPushHandling whenever they need (should be called after identify as noted in the docs).

@tamsel12
Copy link

tamsel12 commented Sep 3, 2019

First of all, thanks for creating and maintaining this great plugin!
@samzilverberg i am trying to do inappMessages. But not getting messages via mixpanel inappmessage. Could you please clarify Mixpanel Plugin do not support InAppMessages?
FYI : I am using latest plugin version

@FELS-Zak
Copy link

FELS-Zak commented Mar 4, 2020

If anyone has gotten this to work for push messaging on iOS and Android, could you please tell me how?

@etiennea
Copy link

etiennea commented Apr 2, 2020

Messaging support would be great! Even if it's just the ability to call a callback handler for the message features or the ability to track opened messages manually.

@tamsel12
Copy link

Hai @samzilverberg I am able to get InApp messages with delay. But i am not able to receive Push notifications. Could you please let me know Pushnotifications will work with Mixpanel cordova?

@samzilverberg
Copy link
Owner

yes push notifications work.
if they are not working for you, its probably a configuration issue or somethign to do with your setup/plugins combo.
either way, I can't help you with that

@tamsel12
Copy link

tamsel12 commented Jul 2, 2020

Yes @samzilverberg , its now working for me , But after logout the application i am not able to clear the pushtoken. I have searched the plugin that it does not provide any method to remove the pushtoken from mixpanel. Is there any function to clear that push token in mixpanel?

@samzilverberg
Copy link
Owner

@tamsel12 your'e right.
the android & iphone sdks have methods to clear push tokens but the plugin doesn't expose them (yet).
no one ever asked for this before 🤷‍♂️

i'll see if i can add these fns to the plugin soon.

@etiennea
Copy link

etiennea commented Jul 6, 2020

To support some of the mp messaging features I did this. If useful to someone.

 window.phonegapPush.on('notification', data => {
            console.log('notification', data);
            let url = '';
            if (
                data.additionalData &&
                data.additionalData.mp_ontap &&
                data.additionalData.mp_ontap.type === 'deeplink' &&
                data.additionalData.mp_ontap.uri
            ) {
                url = data.additionalData.mp_ontap.uri.replace('myapp:///', '/');
            }
            if (
                data.additionalData &&
                data.additionalData.mp_ontap &&
                data.additionalData.mp_ontap.type === 'browser' &&
                data.additionalData.mp_ontap.uri
            ) {
                url = false;
                window.open(data.additionalData.mp_ontap.uri, '_system');
            }
           if (url) router.navigateTo(url);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants