Mixpanel
Overview
The server-side connector forwards subscription lifecycle events from BillDog’s backend into your Mixpanel project with a /track call. Each event’s distinct_id is your app user ID (the BillDog customer ID when there is none). Purchases and renewals put their USD amount in $amount with $currency USD, and a refund sends the same amount negative. The price in the customer’s own currency is in the price_local and currency properties. A /engage profile update sets email, name, country, plan and attribution fields when the event has them.
For those events to land on the same Mixpanel user as your app’s own events, call identify(appUserId) in your Mixpanel SDK with the same app user ID you give BillDog.
1. Connect your Mixpanel project
- In Mixpanel, copy your Project Token from project settings.
- In BillDog, go to Dashboard → Integrations and choose Mixpanel.
- Paste the token into Project Token. That is the only credential BillDog needs: Mixpanel’s ingestion API authenticates with the project token alone.
- If your Mixpanel project is in the EU data residency region, set Data Residency to European Union so events go to
api-eu.mixpanel.com. Events sent to the wrong region land in a different project. - Click Save Integration.
Forwarded events:
| Event | Fires when |
|---|---|
| subscription_created | A new subscription starts, including trials |
| subscription_cancelled | Auto-renew is turned off (the customer keeps access until the period ends) |
| subscription_uncancelled | Auto-renew is turned back on |
| subscription_expired | The subscription ends and access stops |
| purchase_completed | A one-time purchase completes or a subscription renews |
| purchase_refunded | A purchase is refunded (sent as negative revenue) |
Untick events under Events to Forward to stop sending them. If you untick every event, BillDog forwards all of them: an empty selection means no filter.
Storing the distinct ID (optional)
The SDK also has a setMixpanelDistinctID setter. It stores Mixpanel’s distinct_id on the BillDog customer under the attribution key mixpanelDistinctId, and the value comes back in the customer’s attribution data. The connector above does not use it: events are sent with your app user ID as distinct_id.
// iOS — setter is async throws
Task {
try? await BillDog.shared.setMixpanelDistinctID(Mixpanel.mainInstance().distinctId)
}// Android — suspend function returning Result<Unit>
scope.launch {
BillDog.getInstance().setMixpanelDistinctID(mixpanel.getDistinctId())
}// React Native — fire-and-forget, returns void
BillDog.setMixpanelDistinctID(distinctId);Call it after customer info has loaded: with no current customer the setter fails (iOS throws, Android returns a failed Result).
Consent gating
The setter is gated by the SDK’s consent flag. If your app requires consent and it hasn’t been given, the setter fails (iOS throws; Android returns a failed Result). Nothing is queued and nothing leaves the device; call it again after setConsentGiven(true). The server-side connector dispatches from BillDog’s backend and is unaffected by device consent.
Related
Was this page helpful?
Or rate this page: