kikinteractive/mixpanel-android

Name: mixpanel-android

Owner: Kik Interactive

Description: An Android library for Mixpanel Analytics

Created: 2015-11-17 18:56:39.0

Updated: 2018-04-15 20:54:11.0

Pushed: 2016-02-22 18:02:18.0

Homepage: http://mixpanel.com/android-analytics/

Size: 28146

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Getting Started

You can find getting started guides for using Mixpanel at:

See https://github.com/mixpanel/sample-android-mixpanel-integration for a full featured sample application.

License

See LICENSE File for details. The Base64Coder, ConfigurationChecker, and StackBlurManager classes, and the entirety of the com.mixpanel.android.java_websocket package used by this software have been licensed from non-Mixpanel sources and modified for use in the library. Please see the relevant source files, and the LICENSE file in the com.mixpanel.android.java_websocket package for details.

The StackBlurManager class uses an algorithm by Mario Klingemann mario@quansimondo.com You can learn more about the algorithm at http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html.

Want to Contribute?

The Mixpanel library for Android is an open source project, and we'd love to see your contributions! We'd also love for you to come and work with us! Check out http://boards.greenhouse.io/mixpanel/jobs/25078#.U_4BBEhORKU for details.

Changelog
v4.7.0 v4.6.4 v4.6.3 v4.6.1 v4.6 v4.5.3 v4.5.2 v4.5.1 v4.5
ta-data android:name="com.mixpanel.android.MPConfig.DisableGestureBindingUI"
  android:value="true" />

When included in your Manifest with value=“true”, this tag disables the use of the connection gesture to the mobile event binding UI in the Mixpanel web application. Events created and bound in the UI will still be sent by the application, this directive just disables use the connection gesture to pair with a Mixpanel to create and edit event bindings. If the application is run in an emulator, it will still check for pairing with the editor.

ta-data android:name="com.mixpanel.android.MPConfig.DisableEmulatorBindingUI"
  android:value="true" />

When included in your Manifest with value=“true”, this tag disables pairing with the mobile event binding UI in the Mixpanel web application. Events created and bound in the UI will still be sent by the application, this directive just disables the emulator binding behavior. Use of the connection gesture on a physical device will still work for pairing with the editor.

-keepattributes InnerClasses

-keep class .R -keep class .R$* {

<fields>;

}

anel uses the R class of your package to facilitate easier dynamic tracking across builds of your application.

e deprecated methods setFlushInterval and checkForSurvey are now no-ops

 method was deprecated in version 4.0, and now is a no-op. To change the flush
rval for your application, use the com.mixpanel.android.MPConfig.FlushInterval
-data tag in your manifest. To get available surveys, call getSurveyIfAvailable()

e minimum Android OS version necessary for surveys, in-app notifications, and dynamic event binding
s been increased to JellyBean/API 16. The minimum OS version to use basic tracking features
s been increased to Gingerbread/API 9.

 v4.4.1

mproved support for Push notifications in Android Lollipop/API
1. Users sending push notifications to Lollipop devices should
nclude some version of Google Play Services in their build. In
nclude Google Play Services, add the following to your
uild.gradle file:

compile “com.google.android.gms:play-services:3.1+” // Any version above 3.1 will work

 v4.3.1

his is a bugfix release only, to alter the handling of Surveys and In-App notifications when
ctivities are removed or move to the background.

 v4.3.0
dded support for App Links tracking

dded a way to get super properties

 v4.2.2

emoved lint warnings from build

ixed issue that could cause NullPointerExceptions to be thrown from the library
f a user was identified as null

andle attempts to load In-app notifications in low memory conditions

 v4.2.1

ixed a bug that would cause events to be dropped when the device thinks it has a valid network
onnection, but cannot actually send data over it.

 v4.2.0

howSurveyById` and `showNotificationById` have been added for precise control over which
rvey or notification should be displayed.

ded several default properties for Mixpanel People profiles. Each call to `set()` will now
tomatically include the application version name, Android version, and manufacturer, make, and
del of the phone.

 v4.1.0

 version adds support for Android in-app notifications.

ere is now an additional theme parameter on the SurveyActivity declaration in AndroidManifest.xml
at is used for full screen in-app notifications.

<activity android:name=“com.mixpanel.android.surveys.SurveyActivity”

        android:theme="@style/com_mixpanel_android_SurveyActivityTheme"/>
new unified set of functions have been created to make it easier to fetch and display surveys
d in-app notifications.

`getSurveyIfAvailable()` and `getNotificationIfAvailable()` have been added to fetch Survey and
InAppNotification objects when the library has successfully received them. You may use these objects
to display your own custom surveys or in-app notifications.

`showSurveyIfAvailable()` and `showNotificationIfAvailable()` have been added to display surveys and
notifications when the library has successfully received them.

`addOnMixpanelUpdatesReceivedListener()` and `removeOnMixpanelUpdatesReceivedListener()` have been added
so you may be notified when the library has successfully received a survey or in-app notification in the
background.

`showSurvey()` and `checkForSurvey()` functions have been deprecated.

om.mixpanel.android.MPConfig.AutoCheckForSurveys` has been deprecated. The option has been renamed
 `com.mixpanel.android.MPConfig.AutoShowMixpanelUpdates`. It is also now used for both surveys and in-app
tifications.

om.mixpanel.android.MPConfig.TestMode` has been added. This option, when set to true, will render
ur in-app notifications and surveys but not track that they have been displayed. If you have multiple
tifications/surveys, calls the respective show/get methods will simply rotate through them.

ixpanelAPI.logPosts()` has been deprecated. Set the `com.mixpanel.android.MPConfig.EnableDebugLogging`
ag to true to now get extensive debugging output.

e minimum Android version necessary for surveys and in-app notifications has been increased to 14,
e Cream Sandwich to improve stability.

ixpanelAPI.alias()` has been added.

e default library manifest no longer merges in recommended tags by default, as this was breaking
ilds for some users. You'll need to follow the steps in https://mixpanel.com/help/reference/android
 configure your manifest for automatic referrer tracking, push notifications, in-app messages,
d surveys. The recommended `<application>` tag in your app is

      <!-- This activity allows your application to show Mixpanel
           surveys and takeover in-app notifications. -->
      <activity android:name="com.mixpanel.android.surveys.SurveyActivity"
                android:theme="@style/com_mixpanel_android_SurveyActivityTheme" />

      <!-- This receiver will allow your application to register for
           and receive Mixpanel push notifications.
           Make sure to change YOUR_PACKAGE_NAME to your own applications package. -->
      <receiver android:name="com.mixpanel.android.mpmetrics.GCMReceiver"
          android:permission="com.google.android.c2dm.permission.SEND" >
          <intent-filter>
              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
              <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
              <category android:name="YOUR_PACKAGE_NAME" />
          </intent-filter>
      </receiver>

      <!-- This receiver will allow your application to record referrer
           parameters as super properties automatically -->
      <receiver android:name="com.mixpanel.android.mpmetrics.InstallReferrerReceiver" android:exported="true">
          <intent-filter>
              <action android:name="com.android.vending.INSTALL_REFERRER" />
          </intent-filter>
      </receiver>

 v4.0.1

fault event storage is now 5 days.

 v4.0.0

 is a major release, with significant changes to library behavior.

anges to the steps required to integrate the Mixpanel library in your project.

 previous releases, the Mixpanel library was distributed as a jar file. As of 4.0.0,
e of the library varies with the build tools chosen.

#### For Eclipse and Ant

r building with Eclipse or ant, download the Mixpanel repository and follow the steps outlined
re, for "Referencing a Library Project":
tp://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject

#### For Gradle and Android Studio

r building with Gradle or Android Studio- add the following dependency to your build.gradle file
dependencies {
    compile "com.mixpanel.android:mixpanel-android:4.0.0@aar"
}
version of each release is hosted in Maven central, and will not require you to manually
wnload or install any artifacts.

pport for `getPeople().union()`, `getPeople().setOnce()`, and `getPeople().unset()` has been added.

llback to HTTP from HTTPS is disabled by default

 previous releases, the Mixpanel library would automatically fall
ck to communicating over HTTP if HTTPS communication failed. This
s to facilitate use on Android 2.2 (Froyo) and older OS versions,
ich had poor support for modern SSL certificates.

 the 4.0.0, HTTP fallback behavior is disabled by default, but can be
enabled for users who intend to ship to older devices by adding
e following tags to the `<application>` tag in the Application's
droidManifest.xml:

<meta-data android:name=“com.mixpanel.android.MPConfig.DisableFallback”

         android:value="false" />
pport for Mixpanel surveys. Support takes the form of two new API calls
d some new default automatic behavior

`MixpanelAPI.getPeople().checkForSurveys()` will query Mixpanel for surveys
targeted to the current user, and pass a Survey object
to a callback when a survey is found, or null if no Survey could be found

`MixpanelAPI.getPeople().showSurvey()` will launch a new Activity that shows
the given survey to the user, and send the results of the survey to Mixpanel

Unless configured with `com.mixpanel.android.MPConfig.AutoCheckForSurveys` metadata,
applications using the Mixpanel library will automatically query for and show
an available survey on application startup.

ssing a null token or null context to `MixpanelAPI.getInstance()` will result in
null return value.

tomatic `$bluetooth_enabled` property will only be added automatically on devices with
 version greater than API 18/OS version 4.3/Jelly Bean MR2. This feature had a
itical bug on older platforms, and was not in popular use.

ers can now configure `MixpanelAPI` behavior by including `<meta-data>` tags in the `<application>`
g of their apps. The following meta-data keys are supported:

`com.mixpanel.android.MPConfig.FlushInterval` (value: a time in milliseconds)

If provided, the library will use this interval instead of the default as a
target maximum duration between attempts to flush data to Mixpanel's servers.

`com.mixpanel.android.MPConfig.DisableFallback` (value: a boolean)

If provided and equal to "false", the library will attempt to send data over
HTTP if HTTPS fails

`com.mixpanel.android.MPConfig.AutoCheckForSurveys` (value: a boolean)

If provided and equal to "false", the Mixpanel library will not attempt to
retrieve and show surveys automatically, users can still show surveys using
`MixpanelAPI.getPeople().checkForSurvey()` and `MixpanelAPI.getPeople().showSurvey()`

tomatic referrer tracking from the Google Play Store

ding the following to the main `<application>` tag in your AndroidManfest.xml will
tomatically set super properties associated with the referrer to your Google Play Store listing:

<receiver android:name=“com.mixpanel.android.mpmetrics.InstallReferrerReceiver”

        android:exported="true">
  <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>

evious version of the library allowed setting "distinct_id" as a
perProperty, and would use this value as the distinct id for event
acking. This behavior has been removed, and super properties with
e name "distinct_id" will be ignored. Callers can still provide
eir own value for "distinct_id" in the properties argument to track.

scary stack trace log in the common, not-scary case of fallback from HTTPS to HTTP has been
moved.

ixpanelAPI.setFlushInterval()` has been deprecated.
e `<meta-data android:name="com.mixpanel.android.MPConfig.FlushInterval" android:value="XXX" />`
stead, where "XXX" is the desired interval in milliseconds.

ixpanelAPI.enableFallbackServer()` has been deprecated.
e `<meta-data android:name="com.mixpanel.android.MPConfig.DisableFallback" android:value="true" />`
 disable fallback to HTTP if HTTPS is unavailable.

 v3.3.1

ternal changes to improve startup performance.

 v3.3.0

lls to `increment()` now accept more general types (doubles instead of longs)
isting calls should work without changes, types are strictly more general.

yloads of `increment()` are treated as doubles rather than longs in the internal library


 v3.2.0

e library now falls back to HTTP communication if HTTPS communication is unavailable.
 particular, this may occur in early versions of Android that only support a small
t of certificate authorities.
 disable this behavior, call

MixpanelAPI.enableFallbackServer(yourMainActivity, false);

re robust handling of internal threads and work queues.

e Mixpanel library now owns one, continuous thread for handling
ssages (rather than spawning a thread on demand.)

provements to internal library error handling.


 v3.1.1

gfix and test for providing metadata with revenue analytics messages

 v3.1.0

pport for Mixpanel Revenue analytics

e Mixpanel library now supports revenue analytics. To track income, call

Mixpanel.getPeople().trackCharge(amount, properties)

ere amount is a double representing the amount of the charge, and properties is
possibly null collection of properties associated with the charge.

 v3.0.0

jor change to configuration necessary for push notifications

 version 3.0, you will need to add the following receiver to the <application> tag
 your AndroidManifest.xml file to receive push notifications using initPushNotification.

<receiver android:name=“com.mixpanel.android.mpmetrics.GCMReceiver”

        android:permission="com.google.android.c2dm.permission.SEND" >
  <intent-filter>
      <action android:name="com.google.android.c2dm.intent.RECEIVE" />
      <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
      <category android:name="YOUR_PACKAGE_NAME" />
  </intent-filter>

 sure to replace "YOUR_PACKAGE_NAME" above with the package name of your project
he value of the "package" attribute in your <manifest> tag.)

ckward incompatible change: Major change to the handling of automatically assigned distinct ids

 version 3.0, library-assigned distinct ids are randomly generated
d stored as needed. If you are upgrading from an older version
at used the automatically generated distinct id, and you want to
intain the same distinct id across upgrades, you can generate it
th the following code:

String androidId = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID); String oldStyleId = Build.PRODUCT + '_' + androidId; mMixpanel.identify(oldStyleId);

op using version in artifact name

w versions of the Mixpanel library are named "MixpanelAPI.jar",
ther than "MixpanelAPI_vXXX.jar".


 v2.2.3

e SSL api endpoint by default

 v2.2.2

x to of initPushHandling

 v2.2.1

anges to handling of catastrophic database failures (for example, full disks)

e Mixpanel library will now truncate its database in the face of full disks or corrupted
tabases.

 v2.2

anges to default properties sent with every event

uilt-in" properties and names have changed for richer and more
curate names, and to conform with future versions of the iOS
brary.

perimental Feature: Allow users to set default timing for sending server messages

ers can use MixpanelAPI.setFlushInterval to increase or decrease
e default frequency of server messages.

re robust tests

anges to error handling

xpanel will no longer retry sending messages when it encounters
t of memory errors during send.

 v2.1

pport for Mixpanel push notifications

The Mixpanel library now handles registering for and receiving
Google Cloud Messaging notifications sent from the Mixpanel interface.
See https://mixpanel.com/docs/people-analytics/android-push
for instructions on getting started using Mixpanel to
engage directly with users of your application.

t-based build system for core libraries

To build the core library, type 'ANDROID_HOME=/path/to/android/sdk ant library'
at your command line.

I brought closer to Mixpanel Javascript and iPhone APIs

Main class now named "MixpanelAPI", as in iPhone library

Methods renamed to align with iPhone API method names

People Analytics features are now accessed via the
MixpanelAPI.People class, accessed via MixpanelAPI.getPeople()

People.identify is now independent of MixpanelAPI.identify

User identity and super properties now persist across
application shutdown

re explicit threading model

Eliminated dependency on external Looper for timing
of messages sent to Mixpanel

tensive documentation

Public APIs are now more thoroughly documented

it Tests provided as part of core code

nit tests are an Eclipse project under
est/, are run against the demo application

 v2.0

ded support for Mixpanel People
ded MPConfig object for easier configurability
Metrics.VERSION now available
proved debugging information available
ent queuing submission model revamped

 v1.3

to an unexplained increase in Sqlite insertion times on ICS, we now use a background thread to queue up
ts being sent.

 v1.2

d country geolocation by default. Now all events tracked will have the property 'Country.'

 v1.1

nvert MPMetrics into a singleton, fixing a rare race caused by multiple instances.
duce the number of flushes being called when events are backed up.
rrectly check status of API call result
tter support for using multiple tokens within a single Android application

 v1.0 (original)

moved the funnel() methods. Funnels have been built from events for some time now, and this update to Android simply reflects that change we have made.
e proper way to perform funnel analysis is to create a funnel based on events that you are sending. For more information, please see http://mixpanel.com/api/docs/guides/funnel-analysis

named the event method to track, to be more consistent with the existing APIs.
rthermore, the propeties object passed to the new track method is no longer a HashMap, but a JSONObject.
is will cause types to be correctly preseved in Segmentation.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.