Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unset people property using mixpanel JavaScript client

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
like image 700
arthur Avatar asked Oct 20 '22 05:10

arthur


1 Answers

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.

like image 188
Fifer Sheep Avatar answered Oct 21 '22 22:10

Fifer Sheep