Mixpanel
Learn how to set up integration with Mixpanel
To integrate Mixpanel go to Integrations > Mixpanel and set credentials.
You need only one variable: Mixpanel access token. Find the token in your Mixpanel project. If you need help, here's the official docs.
Adapty maps some properties such as user id and revenue of the event to Mixpanel-native properties. With such mapping, Mixpanel is able to show you correct data in the profile and events timeline.
Adapty also accumulates revenue from each user.
Another thing worth mentioning is updating User Profile Properties. Adapty sends the subscription state and subscription product id. After Mixpanel gets an event, you can see the corresponding fields updated there.
SDK configuration
Use Adapty.updateProfile()
method to set mixpanelUserId
. If not set, Adapty uses your user ID (customerUserId
) or if it's null Adapty ID. Make sure that the user id you use to send data to Mixpanel from your app is the same one you send to Adapty.
import Mixpanel
let builder = AdaptyProfileParameters.Builder()
.with(mixpanelUserId: Mixpanel.mainInstance().userId)
Adapty.updateProfile(params: builder.build())
val params = AdaptyProfileParameters.Builder()
.withMixpanelUserId(mixpanelAPI.distinctId)
.build()
Adapty.updateProfile(params) { error ->
if (error != null) {
// handle the error
}
}
import 'package:mixpanel_flutter/mixpanel_flutter.dart';
final mixpanel = await Mixpanel.init("Your Token", trackAutomaticEvents: true);
final builder = AdaptyProfileParametersBuilder()
..setMixpanelUserId(
await mixpanel.getDistinctId(),
);
try {
await Adapty().updateProfile(builder.build());
} on AdaptyError catch (adaptyError) {
// handle error
} catch (e) {}
import { adapty } from 'react-native-adapty';
import { Mixpanel } from 'mixpanel-react-native';
// ...
try {
await adapty.updateProfile({
mixpanelUserId: mixpanelUserId,
});
} catch (error) {
// handle `AdaptyError`
}
var builder = new Adapty.ProfileParameters.Builder();
builder.SetMixpanelUserId(Mixpanel.DistinctId);
Adapty.UpdateProfile(builder.Build(), (error) => {
// handle error
});
Updated about 1 month ago