Reputation: 950
I try to remove a property for a user using mixpanel JavaScript API. As I can see, there is only a method set, but no method unset. I tried to set the property with undefined or null but when I do so, the property still exists with no value. I would like to totally remove it as we can do it with the mixpanel interface. Is that possible?
Thanks for your help!
Some code:
// Let set the property 'foo' with a value 'bar' to the current user
mixpanel.people.set("foo", "bar");
// Now, let unset this proprety
// Oops, there is no method unset...
// Let's try something else
mixpanel.people.set("foo"); // nop...
mixpanel.people.set("foo", undefined); // nop...
mixpanel.people.set("foo", null); // the value is now empty but the property still exists
Upvotes: 5
Views: 1285
Reputation: 1814
You can do
mixpanel.people.unset("123", "my_unused_property")
or
mixpanel.people.unset("123", ["my_unused_property1", "my_unused_property2",..] )
This is unset's signature (distinct_id, property_name)
distinct_id
is the user id in mixpanel
http://www.rubydoc.info/github/mixpanel/mixpanel-ruby/Mixpanel/People#unset-instance_method
Upvotes: 1
Reputation: 2990
The Android MixPanel library (v4.6.4) has an unset(String)
method for people properties, perhaps the JavaScript API has an equivalent, which I would assume to be:
mixpanel.people.unset("foo");
Perhaps this did not exist back in August.
Upvotes: 2