public class MixpanelAPI
extends java.lang.Object
Call getInstance(Context, String, boolean) with
your main application activity and your Mixpanel API token as arguments
an to get an instance you can use to report how users are using your
application.
Once you have an instance, you can send events to Mixpanel
using track(String, JSONObject), and update People Analytics
records with getPeople()
The Mixpanel library will periodically send information to
Mixpanel servers, so your application will need to have
android.permission.INTERNET. In addition, to preserve
battery life, messages to Mixpanel servers may not be sent immediately
when you call track(String)or MixpanelAPI.People.set(String, Object).
The library will send messages periodically throughout the lifetime
of your application, but you will need to call flush()
before your application is completely shutdown to ensure all of your
events are sent.
A typical use-case for the library 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 whenSomethingInterestingHappens(int flavor) {
JSONObject properties = new JSONObject();
properties.put("flavor", flavor);
mMixpanel.track("Something Interesting Happened", properties);
...
}
public void onDestroy() {
mMixpanel.flush();
super.onDestroy();
}
}
In addition to this documentation, you may wish to take a look at
the Mixpanel sample Android application.
It demonstrates a variety of techniques, including
updating People Analytics records with MixpanelAPI.People and others.
There are also step-by-step getting started documents available at mixpanel.com
| Modifier and Type | Class and Description |
|---|---|
static interface |
MixpanelAPI.Group
Core interface for using Mixpanel Group Analytics features.
|
static interface |
MixpanelAPI.People
Core interface for using Mixpanel People Analytics features.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VERSION
String version of the library.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGroup(java.lang.String groupKey,
java.lang.Object groupID)
Add a group to this user's membership for a particular group key
|
void |
alias(java.lang.String alias,
java.lang.String distinct_id)
This function creates a distinct_id alias from alias to distinct_id.
|
void |
clearSuperProperties()
Erase all currently registered superProperties.
|
void |
clearTimedEvent(java.lang.String eventName)
Clears the event timing for an event.
|
void |
clearTimedEvents()
Clears all current event timings.
|
double |
eventElapsedTime(java.lang.String eventName)
Retrieves the time elapsed for the named event since timeEvent() was called.
|
void |
flush()
Push all queued Mixpanel events and People Analytics changes to Mixpanel servers.
|
java.lang.String |
getAnonymousId()
Returns the anonymoous id currently being used to uniquely identify the device and all
with events sent using
track(String, JSONObject) will have this id as a device
id |
java.util.Map<java.lang.String,java.lang.String> |
getDeviceInfo()
Returns an unmodifiable map that contains the device description properties
that will be sent to Mixpanel.
|
java.lang.String |
getDistinctId()
Returns the string id currently being used to uniquely identify the user.
|
int |
getFlushBatchSize()
Get maximum number of events/updates to send in a single network request
|
MixpanelAPI.Group |
getGroup(java.lang.String groupKey,
java.lang.Object groupID)
Returns a Mixpanel.Group object that can be used to set and increment
Group Analytics properties.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
boolean optOutTrackingDefault,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
boolean optOutTrackingDefault,
org.json.JSONObject superProperties,
java.lang.String instanceName,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
boolean optOutTrackingDefault,
java.lang.String instanceName,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
org.json.JSONObject superProperties,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
org.json.JSONObject superProperties,
java.lang.String instanceName,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
static MixpanelAPI |
getInstance(android.content.Context context,
java.lang.String token,
java.lang.String instanceName,
boolean trackAutomaticEvents)
Get the instance of MixpanelAPI associated with your Mixpanel project token.
|
int |
getMaximumDatabaseLimit()
Get the maximum size limit to the Mixpanel database.
|
MixpanelAPI.People |
getPeople()
Returns a Mixpanel.People object that can be used to set and increment
People Analytics properties.
|
org.json.JSONObject |
getSuperProperties()
Returns a json object of the user's current super properties
|
java.lang.Boolean |
getTrackAutomaticEvents() |
protected java.lang.String |
getUserId()
Returns the user id with which identify is called and all the with events sent using
track(String, JSONObject) will have this id as a user id |
boolean |
hasOptedOutTracking()
Will return true if the user has opted out from tracking.
|
void |
identify(java.lang.String distinctId)
Equivalent to
identify(String, boolean) with a true argument for usePeople. |
void |
identify(java.lang.String distinctId,
boolean usePeople)
Associate all future calls to
track(String, JSONObject) with the user identified by
the given distinct id. |
boolean |
isAppInForeground()
Based on the application's event lifecycle this method will determine whether the app
is running in the foreground or not.
|
void |
optInTracking()
Use this method to opt-in an already opted-out user from tracking.
|
void |
optInTracking(java.lang.String distinctId)
Use this method to opt-in an already opted-out user from tracking.
|
void |
optInTracking(java.lang.String distinctId,
org.json.JSONObject properties)
Use this method to opt-in an already opted-out user from tracking.
|
void |
optOutTracking()
Use this method to opt-out a user from tracking.
|
void |
registerSuperProperties(org.json.JSONObject superProperties)
Register properties that will be sent with every subsequent call to
track(String, JSONObject). |
void |
registerSuperPropertiesMap(java.util.Map<java.lang.String,java.lang.Object> superProperties)
Register properties that will be sent with every subsequent call to
track(String, JSONObject). |
void |
registerSuperPropertiesOnce(org.json.JSONObject superProperties)
Register super properties for events, only if no other super property with the
same names has already been registered.
|
void |
registerSuperPropertiesOnceMap(java.util.Map<java.lang.String,java.lang.Object> superProperties)
Register super properties for events, only if no other super property with the
same names has already been registered.
|
void |
removeGroup(java.lang.String groupKey,
java.lang.Object groupID)
Remove a group from this user's membership for a particular group key
|
void |
reset()
Clears tweaks and all distinct_ids, superProperties, and push registrations from persistent storage.
|
void |
setEnableLogging(boolean enableLogging)
Controls whether to enable the run time debug logging
|
void |
setFlushBatchSize(int flushBatchSize)
Set maximum number of events/updates to send in a single network request
|
void |
setGroup(java.lang.String groupKey,
java.util.List<java.lang.Object> groupIDs)
Set the groups this user belongs to.
|
void |
setGroup(java.lang.String groupKey,
java.lang.Object groupID)
Set the group this user belongs to.
|
void |
setMaximumDatabaseLimit(int maximumDatabaseLimit)
Set an integer number of bytes, the maximum size limit to the Mixpanel database.
|
void |
setServerURL(java.lang.String serverURL)
Set the base URL used for Mixpanel API requests.
|
void |
setServerURL(java.lang.String serverURL,
ProxyServerInteractor callback)
Set the base URL used for Mixpanel API requests.
|
void |
setUseIpAddressForGeolocation(boolean useIpAddressForGeolocation)
Controls whether to automatically send the client IP Address as part of event tracking.
|
void |
timeEvent(java.lang.String eventName)
Begin timing of an event.
|
void |
track(java.lang.String eventName)
Equivalent to
track(String, JSONObject) with a null argument for properties. |
void |
track(java.lang.String eventName,
org.json.JSONObject properties)
Track an event.
|
protected void |
track(java.lang.String eventName,
org.json.JSONObject properties,
boolean isAutomaticEvent) |
void |
trackMap(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> properties)
Track an event.
|
void |
trackWithGroups(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.Map<java.lang.String,java.lang.Object> groups)
Track an event with specific groups.
|
void |
unregisterSuperProperty(java.lang.String superPropertyName)
Remove a single superProperty, so that it will not be sent with future calls to
track(String, JSONObject). |
void |
updateSuperProperties(SuperPropertyUpdate update)
Updates super properties in place.
|
public static final java.lang.String VERSION
public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.trackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, java.lang.String instanceName, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.instanceName - The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project tokentrackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, boolean optOutTrackingDefault, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.optOutTrackingDefault - Whether or not Mixpanel can start tracking by default. See
optOutTracking().trackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, boolean optOutTrackingDefault, java.lang.String instanceName, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.optOutTrackingDefault - Whether or not Mixpanel can start tracking by default. See
optOutTracking().instanceName - The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project token.trackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, org.json.JSONObject superProperties, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.superProperties - A JSONObject containing super properties to register.trackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, org.json.JSONObject superProperties, java.lang.String instanceName, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.superProperties - A JSONObject containing super properties to register.instanceName - The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project tokentrackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public static MixpanelAPI getInstance(android.content.Context context, java.lang.String token, boolean optOutTrackingDefault, org.json.JSONObject superProperties, java.lang.String instanceName, boolean trackAutomaticEvents)
Use getInstance to get a reference to a shared instance of MixpanelAPI you can use to send events and People Analytics updates to Mixpanel.
getInstance is thread safe, but the returned instance is not, and may be shared with other callers of getInstance. The best practice is to call getInstance, and use the returned MixpanelAPI, object from a single thread (probably the main UI thread of your application).
If you do choose to track events from multiple threads in your application, you should synchronize your calls on the instance itself, like so:
MixpanelAPI instance = MixpanelAPI.getInstance(context, token);
synchronized(instance) { // Only necessary if the instance will be used in multiple threads.
instance.track(...)
}
context - The application context you are trackingtoken - Your Mixpanel project token. You can get your project token on the Mixpanel web site,
in the settings dialog.optOutTrackingDefault - Whether or not Mixpanel can start tracking by default. See
optOutTracking().superProperties - A JSONObject containing super properties to register.instanceName - The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project tokentrackAutomaticEvents - Whether or not to collect common mobile events
include app sessions, first app opens, app updated, etc.public void setUseIpAddressForGeolocation(boolean useIpAddressForGeolocation)
With an IP address, geo-location is possible down to neighborhoods within a city, although the Mixpanel Dashboard will just show you city level location specificity.
useIpAddressForGeolocation - If true, automatically send the client IP Address. Defaults to true.public void setEnableLogging(boolean enableLogging)
enableLogging - If true, emit more detailed log messages. Defaults to falsepublic void setFlushBatchSize(int flushBatchSize)
flushBatchSize - int, the number of events to be flushed at a time, defaults to 50public int getFlushBatchSize()
public void setMaximumDatabaseLimit(int maximumDatabaseLimit)
maximumDatabaseLimit - an integer number of bytes, the maximum size limit to the Mixpanel database.public int getMaximumDatabaseLimit()
public void setServerURL(java.lang.String serverURL)
serverURL - the base URL used for Mixpanel API requestspublic void setServerURL(java.lang.String serverURL,
ProxyServerInteractor callback)
serverURL - the base URL used for Mixpanel API requestscallback - the callback for mixpanel proxy server api headers and statuspublic java.lang.Boolean getTrackAutomaticEvents()
public void alias(java.lang.String alias,
java.lang.String distinct_id)
identify(String) is called.
This call does not identify the user after. You must still call identify(String) if you wish the new alias to be used for Events and People.
alias - the new value that should represent distinct_id.distinct_id - the old distinct_id that alias will be mapped to.public void identify(java.lang.String distinctId)
identify(String, boolean) with a true argument for usePeople.
By default, this method will also associate future calls
to MixpanelAPI.People.set(JSONObject), MixpanelAPI.People.increment(Map), MixpanelAPI.People.append(String, Object), etc...
with a particular People Analytics user with the distinct id.
If you do not want to do that, you must call identify(String, boolean) with false for second argument.
NOTE: This behavior changed in version 6.2.0, previously MixpanelAPI.People.identify(String) had
to be called separately.
distinctId - a string uniquely identifying this user. Events sent to
Mixpanel or Users identified using the same distinct id will be considered associated with the
same visitor/customer for retention and funnel reporting, so be sure that the given
value is globally unique for each individual user you intend to track.public void identify(java.lang.String distinctId,
boolean usePeople)
track(String, JSONObject) with the user identified by
the given distinct id.
Calls to track(String, JSONObject) made before corresponding calls to identify
will use an anonymous locally generated distinct id, which means it is best to call identify
early to ensure that your Mixpanel funnels and retention analytics can continue to track the
user throughout their lifetime. We recommend calling identify when the user authenticates.
Once identify is called, the local distinct id persists across restarts of your application.
distinctId - a string uniquely identifying this user. Events sent to
Mixpanel using the same disinct id will be considered associated with the
same visitor/customer for retention and funnel reporting, so be sure that the given
value is globally unique for each individual user you intend to track.usePeople - boolean indicating whether or not to also call
MixpanelAPI.People.identify(String)public void timeEvent(java.lang.String eventName)
eventName - the name of the event to track with timing.public void clearTimedEvents()
public void clearTimedEvent(java.lang.String eventName)
eventName - the name of the timed event to clear.public double eventElapsedTime(java.lang.String eventName)
eventName - the name of the event to be tracked that was previously called with timeEvent()timeEvent(String) was called for the given eventName.public void trackMap(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> properties)
Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event.
eventName - The name of the event to sendproperties - A Map containing the key value pairs of the properties to include in this event.
Pass null if no extra properties exist.
See also track(String, org.json.JSONObject)public void trackWithGroups(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.util.Map<java.lang.String,java.lang.Object> groups)
Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event. Group key/value pairs are upserted into the property map before tracking.
eventName - The name of the event to sendproperties - A Map containing the key value pairs of the properties to include in this event.
Pass null if no extra properties exist.groups - A Map containing the group key value pairs for this event.
See also track(String, org.json.JSONObject), trackMap(String, Map)public void track(java.lang.String eventName,
org.json.JSONObject properties)
Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event.
eventName - The name of the event to sendproperties - A JSONObject containing the key value pairs of the properties to include in this event.
Pass null if no extra properties exist.public void track(java.lang.String eventName)
track(String, JSONObject) with a null argument for properties.
Consider adding properties to your tracking to get the best insights and experience from Mixpanel.eventName - the name of the event to sendpublic void flush()
Events and People messages are pushed gradually throughout the lifetime of your application. This means that to ensure that all messages are sent to Mixpanel when your application is shut down, you will need to call flush() to let the Mixpanel library know it should send all remaining messages to the server. We strongly recommend placing a call to flush() in the onDestroy() method of your main application activity.
public org.json.JSONObject getSuperProperties()
SuperProperties are a collection of properties that will be sent with every event to Mixpanel, and persist beyond the lifetime of your application.
public java.lang.String getDistinctId()
identify(String), this will be an id automatically generated by the library.identify(String)public java.lang.String getAnonymousId()
track(String, JSONObject) will have this id as a device
idprotected java.lang.String getUserId()
track(String, JSONObject) will have this id as a user idpublic void registerSuperPropertiesMap(java.util.Map<java.lang.String,java.lang.Object> superProperties)
track(String, JSONObject).
SuperProperties are a collection of properties that will be sent with every event to Mixpanel, and persist beyond the lifetime of your application.
Setting a superProperty with registerSuperProperties will store a new superProperty,
possibly overwriting any existing superProperty with the same name (to set a
superProperty only if it is currently unset, use registerSuperPropertiesOnce(JSONObject))
SuperProperties will persist even if your application is taken completely out of memory.
to remove a superProperty, call unregisterSuperProperty(String) or clearSuperProperties()
superProperties - A Map containing super properties to register
See also registerSuperProperties(org.json.JSONObject)public void registerSuperProperties(org.json.JSONObject superProperties)
track(String, JSONObject).
SuperProperties are a collection of properties that will be sent with every event to Mixpanel, and persist beyond the lifetime of your application.
Setting a superProperty with registerSuperProperties will store a new superProperty,
possibly overwriting any existing superProperty with the same name (to set a
superProperty only if it is currently unset, use registerSuperPropertiesOnce(JSONObject))
SuperProperties will persist even if your application is taken completely out of memory.
to remove a superProperty, call unregisterSuperProperty(String) or clearSuperProperties()
superProperties - A JSONObject containing super properties to registerregisterSuperPropertiesOnce(JSONObject),
unregisterSuperProperty(String),
clearSuperProperties()public void unregisterSuperProperty(java.lang.String superPropertyName)
track(String, JSONObject).
If there is a superProperty registered with the given name, it will be permanently
removed from the existing superProperties.
To clear all superProperties, use clearSuperProperties()
superPropertyName - name of the property to unregisterregisterSuperProperties(JSONObject)public void registerSuperPropertiesOnceMap(java.util.Map<java.lang.String,java.lang.Object> superProperties)
Calling registerSuperPropertiesOnce will never overwrite existing properties.
superProperties - A Map containing the super properties to register.
See also registerSuperPropertiesOnce(org.json.JSONObject)public void registerSuperPropertiesOnce(org.json.JSONObject superProperties)
Calling registerSuperPropertiesOnce will never overwrite existing properties.
superProperties - A JSONObject containing the super properties to register.registerSuperProperties(JSONObject)public void clearSuperProperties()
Future tracking calls to Mixpanel will not contain the specific superProperties registered before the clearSuperProperties method was called.
To remove a single superProperty, use unregisterSuperProperty(String)
registerSuperProperties(JSONObject)public void updateSuperProperties(SuperPropertyUpdate update)
update - A function from one set of super properties to another. The update should not return null.public void setGroup(java.lang.String groupKey,
java.lang.Object groupID)
groupKey - The property name associated with this group type (must already have been set up).groupID - The group the user belongs to.public void setGroup(java.lang.String groupKey,
java.util.List<java.lang.Object> groupIDs)
groupKey - The property name associated with this group type (must already have been set up).groupIDs - The list of groups the user belongs to.public void addGroup(java.lang.String groupKey,
java.lang.Object groupID)
groupKey - The property name associated with this group type (must already have been set up).groupID - The new group the user belongs to.public void removeGroup(java.lang.String groupKey,
java.lang.Object groupID)
groupKey - The property name associated with this group type (must already have been set up).groupID - The group value to remove.public MixpanelAPI.People getPeople()
MixpanelAPI.People that you can use to update
records in Mixpanel People Analytics.public MixpanelAPI.Group getGroup(java.lang.String groupKey, java.lang.Object groupID)
groupKey - String identifying the type of group (must be already in use as a group key)groupID - Object identifying the specific groupMixpanelAPI.Group that you can use to update
records in Mixpanel Group Analyticspublic void reset()
public java.util.Map<java.lang.String,java.lang.String> getDeviceInfo()
public void optOutTracking()
flush() before calling this method if you want
to send all the queues to Mixpanel before.
This method will also remove any user-related information from the device.public void optInTracking()
optInTracking(String) and
optInTracking(String, JSONObject)
See also optOutTracking().public void optInTracking(java.lang.String distinctId)
distinctId - Optional string to use as the distinct ID for events.
This will call identify(String).
See also optInTracking(String), optInTracking(String, JSONObject) and
optOutTracking().public void optInTracking(java.lang.String distinctId,
org.json.JSONObject properties)
distinctId - Optional string to use as the distinct ID for events.
This will call identify(String).properties - Optional JSONObject that could be passed to add properties to the
opt-in event that is sent to Mixpanel.
See also optInTracking() and optOutTracking().public boolean hasOptedOutTracking()
optOutTracking() and
getInstance(Context, String, boolean, JSONObject, String, boolean) for more information.public boolean isAppInForeground()
protected void track(java.lang.String eventName,
org.json.JSONObject properties,
boolean isAutomaticEvent)