CleverPush can be integrated with Mixpanel in 2 directions:
- Sync events from CleverPush to Mixpanel (opt-ins, opt-outs, notification deliveries, notification clicks)
- Sync cohorts from Mixpanel to CleverPush tags
Sync events from CleverPush to Mixpanel
In CleverPush, navigate to Channels -> (select channel) -> (select platform) -> Webhooks.
Here you can add a new Webhook:
Now, please select the type “Mixpanel” at the top. You should then see the following settings:
- Mixpanel server location: Depends on where your Mixpanel account is hosted (EU / non-EU)
- Mixpanel project ID: You can see it in your project settings: https://help.mixpanel.com/hc/en-us/articles/115004490503-Project-Settings
- Mixpanel Service account username & password: Please see the Mixpanel docs on how to create a new Service account: https://developer.mixpanel.com/reference/service-accounts
- CleverPush Attribute: Here you can select the attribute which will contain the “Distinct ID” from Mixpanel. This is required for matching the users from Mixpanel and CleverPush. This attribute can be populated via our SDKs, see below for some examples.
- Webhook events: The events you want be sent to Mixpanel
Sync cohorts from Mixpanel to CleverPush tags
Please see the official Mixpanel guide for more information on how to setup the Webhooks to Mixpanel:
https://developer.mixpanel.com/docs/cohort-webhooks
To setup the Webhook you will need to following data:
- URL:
https://api.cleverpush.com/channel/CHANNEL_ID_HERE/mixpanel-webhook
Please replace the Channel ID with your CleverPush channel ID. You can find the channel ID in the CleverPush backend when editing a channel. It is the last part of the URL (e.g. AbC123DeFgH123TgH) - HTTP Basic Auth Username:
apikey - HTTP Basic Auth Password:
Your CleverPush API Key, can be found in CleverPush under settings -> API.
Populate Mixpanel Distinct ID to CleverPush attribute
This step is necessary to allow matching the Mixpanel users and the CleverPush subscriptions.
Step 1: Create attribute “user_id” in CleverPush under Channels -> Attributes
Step 2: Assign the attribute value via our SDK from the Mixpanel SDK.
Example:
iOS – ObjectiveC:
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:@"YOUR API TOKEN"];
[CleverPush setSubscriptionAttribute:@"user_id" value:[mixpanel distinctId]];
iOS – Swift:
CleverPush.setSubscriptionAttribute("user_id", Mixpanel.mainInstance().distinctId);
Android:
CleverPush.setSubscriptionAttribute("user_id", mixpanel.getDistinctId());