nao
nao

Reputation: 1188

Mixpanel: Undo or delete an event

On MixPanel, I track an event like so:

mixpanel.track('Action A')

I allow visitors to undo their actions when filling out a sign-up form. I would like to be able to send another event to undo the previous event:

mixpanel.decrement('Action A')

However, the decrement function in Mixpanel is only available on user properties, not events. I don't have unique_ids on these events because it's server-side and triggered by anonymous users, but I would like the ability to increment and decrement an accurate count of Action A. How can I delete the initial event or decrement the count by 1?

Upvotes: 2

Views: 1528

Answers (1)

Scott Havard
Scott Havard

Reputation: 79

There is no way to delete events that are ingested by Mixpanel with no unique_id's connected to them.

It is possible to hide them so they don't appear in reports, but that sounds like it will defeat the purpose of what you are trying to accomplish.

Mixpanel does have documentation on making an incremental super property, which is tied to events and not people. A super property is a property that is sent with every event. The method mixpanel.register() is what is used to create Super Properties, but it also allows values to be overwritten which is one way to build an incremental/decremental event property.

This unfortunately involves building a function, but it should serve as a workaround. If you are using JS the function would look something like:

//define the incrementing function
incrementer = function(property) {
value = mixpanel.get_property(property);

update = {}
//Ensure that 'value' has a type = number
if(value && typeof(value) == 'number') {
  update[property] = value +1;
}
else {
  update[property] = 1
}
  mixpanel.register(update);
};

There is some documentation on this here.

I think this will involve a little bit of tweaking depending on your implementation, but let me know if that helps solve it.

Upvotes: 3

Related Questions