Mixpanel

With the Mixpanel integration, you can attach feature access properties to users and groups on Mixpanel. This will enable you to query analytics based on feature access filters.

Get available features from Bucket

In this example, we're using the Browser SDK:

//init
const bucket = new BucketBrowserSDK.BucketClient({
    publishableKey: "pub_prod_5eS0G5hX4ZOpwoAw1CKTeP",
    user: { 
        id: "u1234", 
        name: "Rasmus Makwarth" 
    },
});

//get features
const features = bucket.getFeatures();

This will return JSON with all available features for the authenticated user:

"features": {
    "export-to-csv": {
        "isEnabled": true,
        "key": "export-to-csv",
        "targetingVersion": 2
    },
    ...
}

Add as property on Mixpanel

We can forward all features or pick certain features and send access state to Mixpanel. Here we send an array of features that the user has access to:

mixpanel.identify("u1234");
mixpanel.people.set({
  $name: "Rasmus Makwarth",
  $features: ["export-to-csv"],
});

Which will look like this on Mixpanel:

You may want to add the property to the user's group as well.

Last updated