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:
    MixpanelAPI
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deleteGroup()
      Permanently deletes this group's record from Group Analytics.
      void remove​(java.lang.String name, java.lang.Object value)
      Remove value from a list-valued property only if it is already present in the list.
      void set​(java.lang.String propertyName, java.lang.Object value)
      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 setMap​(java.util.Map<java.lang.String,​java.lang.Object> properties)
      Set a collection of properties on the identified group all at once.
      void setOnce​(java.lang.String propertyName, java.lang.Object value)
      Works just like set(String, Object), except it will not overwrite existing property values.
      void setOnce​(org.json.JSONObject properties)
      Like set(String, Object), but will not set properties that already exist on a record.
      void setOnceMap​(java.util.Map<java.lang.String,​java.lang.Object> properties)
      Like set(String, Object), but will not set properties that already exist on a record.
      void union​(java.lang.String name, org.json.JSONArray value)
      Adds values to a list-valued property only if they are not already present in the list.
      void unset​(java.lang.String name)
      Permanently removes the property with the given name from the group's profile
    • Method Detail

      • set

        void set​(java.lang.String propertyName,
                 java.lang.Object value)
        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

        void setMap​(java.util.Map<java.lang.String,​java.lang.Object> properties)
        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 also set(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

        void setOnce​(java.lang.String propertyName,
                     java.lang.Object value)
        Works just like set(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

        void setOnceMap​(java.util.Map<java.lang.String,​java.lang.Object> properties)
        Like set(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 also setOnce(org.json.JSONObject)
      • setOnce

        void setOnce​(org.json.JSONObject properties)
        Like set(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

        void union​(java.lang.String name,
                   org.json.JSONArray value)
        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 modify
        value - an array of values to add to the property value if not already present
      • remove

        void remove​(java.lang.String name,
                    java.lang.Object value)
        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 removed
        value - the value that will be removed from the list
      • unset

        void unset​(java.lang.String name)
        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.