how can I remove a item from a profile list property
Hi Bob T., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To remove an item from a profile list property in Mixpanel, you can use the remove
method available in various SDKs or the Ingestion API. Here are some examples based on different platforms:
Using Mixpanel SDKs
JavaScript (Node.js)
mp.groups.set('company','mixpanel', {
name: 'Mixpanel',
features: ['reports','alerts','cohorts']
});
// remove "alerts" from "features"
// "features" now contain ["reports","cohorts"]
mp.groups.remove('company','mixpanel', {
'features': ['alerts']
});LBKS```LBKS[Source](https://docs.mixpanel.com/docs/tracking-methods/sdks/nodejs#other-group-profile-methods)
Java
import com.mixpanel.mixpanelapi.MixpanelAPI;
MixpanelAPI mixpanel = new MixpanelAPI();
MessageBuilder messageBuilder = new MessageBuilder("YOUR_PROJECT_TOKEN");
// Create a group profile with group_key = "company", group_id = "mixpanel"
ArrayList<String> featuresList = new ArrayList<String> (
Arrays.asList("alert","report","cohort")
);
JSONObject groupProps = new JSONObject();
groupProps.put("name", "Mixpanel");
groupProps.put("features", featuresList);
JSONObject message = messageBuilder.groupSet(
"company",
"mixpanel",
groupProps
);
mixpanel.sendMessage(message);
//remove "alert" from "features"
// "features" now contain ["reports","cohorts"]
JSONObject removeFeature = new JSONObject();
removeFeature.put("features","alert");
JSONObject newMsg = messageBuilder.groupRemove(
"company",
"mixpanel",
removeFeature
);
mixpanel.sendMessage(newMsg);LBKS```LBKS[Source](https://docs.mixpanel.com/docs/tracking-methods/sdks/java#other-group-profile-methods)
Using the Ingestion API
User Profiles
"required": true,
"content": {
"application/json": {
"schema": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"description": "A JSON update object, with a $token, $distinct_id, and $remove operation object.",
"required": ["$token", "$distinct_id", "$remove"],
"properties": {
"$token": {"type": "string", "default": "YOUR_PROJECT_TOKEN"},
"$distinct_id": {"type": "string", "default": "13793"},
"$remove": {"type": "object"}
}
}
}
}
}
}LBKS```LBKS[Source](https://github.com/mixpanel/docs/blob/main/openapi/src/ingestion.openapi.yaml)LBKSThese examples show how to remove a specific value from a list property in a user or group profile using different Mixpanel SDKs and the Ingestion API. Make sure to replace placeholders like `YOUR_PROJECT_TOKEN` and `distinct_id` with your actual project token and user identifier.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
can you show me a curl example for the REST API we are using golang
Let me check the knowledge base for you again. One moment! 📚