Package com.mixpanel.android.mpmetrics
Interface MixpanelAPI.Group
- Enclosing class:
- MixpanelAPI
public static interface MixpanelAPI.Group
Core interface for using Mixpanel Group Analytics features.
You can get an instance by calling
MixpanelAPI.getGroup(String, Object)
The Group object is used to update properties in a group's Group Analytics record. A typical use case for the Group object might look like this:
public class MainActivity extends Activity {
MixpanelAPI mMixpanel;
public void onCreate(Bundle saved) {
mMixpanel = MixpanelAPI.getInstance(this, "YOUR MIXPANEL API TOKEN");
...
}
public void companyPlanTypeChanged(string company, String newPlan) {
mMixpanel.getGroup("Company", company).set("Plan Type", newPlan);
...
}
public void onDestroy() {
mMixpanel.flush();
super.onDestroy();
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Permanently deletes this group's record from Group Analytics.void
Remove value from a list-valued property only if it is already present in the list.void
Sets a single property with the given name and value for this group.void
set
(org.json.JSONObject properties) Set a collection of properties on the identified group all at once.void
Set a collection of properties on the identified group all at once.void
Works just likeset(String, Object)
, except it will not overwrite existing property values.void
setOnce
(org.json.JSONObject properties) Likeset(String, Object)
, but will not set properties that already exist on a record.void
setOnceMap
(Map<String, Object> properties) Likeset(String, Object)
, but will not set properties that already exist on a record.void
Adds values to a list-valued property only if they are not already present in the list.void
Permanently removes the property with the given name from the group's profile
-
Method Details
-
set
Sets a single property with the given name and value for this group. The given name and value will be assigned to the user in Mixpanel Group Analytics, possibly overwriting an existing property with the same name.- Parameters:
propertyName
- The name of the Mixpanel property. This must be a String, for example "Zip Code"value
- The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
-
setMap
Set a collection of properties on the identified group all at once.- Parameters:
properties
- a Map containing the collection of properties you wish to apply to the identified group. Each key in the Map will be associated with a property name, and the value of that key will be assigned to the property. See alsoset(org.json.JSONObject)
-
set
void set(org.json.JSONObject properties) Set a collection of properties on the identified group all at once.- Parameters:
properties
- a JSONObject containing the collection of properties you wish to apply to the identified group. Each key in the JSONObject will be associated with a property name, and the value of that key will be assigned to the property.
-
setOnce
Works just likeset(String, Object)
, except it will not overwrite existing property values. This is useful for properties like "First login date".- Parameters:
propertyName
- The name of the Mixpanel property. This must be a String, for example "Zip Code"value
- The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
-
setOnceMap
Likeset(String, Object)
, but will not set properties that already exist on a record.- Parameters:
properties
- a Map containing the collection of properties you wish to apply to the identified group. Each key in the Map will be associated with a property name, and the value of that key will be assigned to the property. See alsosetOnce(org.json.JSONObject)
-
setOnce
void setOnce(org.json.JSONObject properties) Likeset(String, Object)
, but will not set properties that already exist on a record.- Parameters:
properties
- a JSONObject containing the collection of properties you wish to apply to this group. Each key in the JSONObject will be associated with a property name, and the value of that key will be assigned to the property.
-
union
Adds values to a list-valued property only if they are not already present in the list. If the property does not currently exist, it will be created with the given list as its value. If the property exists and is not list-valued, the union will be ignored.- Parameters:
name
- name of the list-valued property to set or modifyvalue
- an array of values to add to the property value if not already present
-
remove
Remove value from a list-valued property only if it is already present in the list. If the property does not currently exist, the remove will be ignored. If the property exists and is not list-valued, the remove will be ignored.- Parameters:
name
- the Group Analytics list-valued property that should have a value removedvalue
- the value that will be removed from the list
-
unset
Permanently removes the property with the given name from the group's profile- Parameters:
name
- name of a property to unset
-
deleteGroup
void deleteGroup()Permanently deletes this group's record from Group Analytics.Calling deleteGroup deletes an entire record completely. Any future calls to Group Analytics using the same group value will create and store new values.
-