From 886cf03960f125e6248f8fbf093f5e10c8311b96 Mon Sep 17 00:00:00 2001 From: Manduro Date: Mon, 13 Nov 2017 09:53:53 +0100 Subject: [PATCH] mixpanel: 2.14 with new method --- types/mixpanel/index.d.ts | 17 ++++++++++++++++- types/mixpanel/mixpanel-tests.ts | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/types/mixpanel/index.d.ts b/types/mixpanel/index.d.ts index 4964a55c79..08bbe26720 100644 --- a/types/mixpanel/index.d.ts +++ b/types/mixpanel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mixpanel 2.13 +// Type definitions for Mixpanel 2.14 // Project: https://mixpanel.com/ // https://github.com/mixpanel/mixpanel-js // Definitions by: Knut Eirik Leira Hjelle @@ -348,6 +348,21 @@ declare namespace Mixpanel { set_once(prop: string, value: any, callback?: () => void): void; set_once(keys: { [index: string]: any }, callback?: () => void): void; + /** + * Unset properties on a user record (permanently removes the properties and their values from a profile). + * + * ### Usage: + * + * mixpanel.people.unset('gender'); + * + * // or unset multiple properties at once + * mixpanel.people.unset(['gender', 'Company']); + * + * @param prop If a string, this is the name of the property. If an array, this is a list of property names. + * @param callback If provided, the callback will be called after the tracking event + */ + unset(prop: string | string[], callback?: () => void): void; + /** * Increment/decrement numeric people analytics properties. * diff --git a/types/mixpanel/mixpanel-tests.ts b/types/mixpanel/mixpanel-tests.ts index b1d735c22e..a48cd4065a 100644 --- a/types/mixpanel/mixpanel-tests.ts +++ b/types/mixpanel/mixpanel-tests.ts @@ -95,6 +95,11 @@ function mixpanel_people() { 'Starting Plan': 'Premium' }, () => {}); + mixpanel.people.unset('Company'); + mixpanel.people.unset('Company', () => {}); + mixpanel.people.unset(['Company', 'Plan']); + mixpanel.people.unset(['Company', 'Plan'], () => {}); + mixpanel.people.increment('page_views'); mixpanel.people.increment('page_views', 1); mixpanel.people.increment('credits_left', -1);