.. _mixpanel: ================================================================================ Mixpanel ================================================================================ Mixpanel is an analytics platform that tracks user interactions with web and mobile applications and provides tools for targeted communication with them. Apptimize integrates with Mixpanel by automatically importing the following for iOS and Android: * Events * User Super Properties * Cohorts You are also able to use the Apptimize TestInfo API and our participation callbacks to forward your experiment data to MixPanel. :ref:`Please see our data export guidelines for more information on how to set this up.` Automatic Event Importing ================================================================================ Apptimize detects Mixpanel Events and automatically imports them for use as Goals within your Apptimize Experiments. Apptimize does not support event properties or attributes, so please note that your events will only be imported per their labels. Please note that if you are using Mixpanel's Swift library, Automatic Importing in Apptimize is currently not supported. .. tabs:: .. code-tab:: objectivec iOS (Objective-C) :caption: iOS (Objective-C) // In this example, Apptimize will auto-import "Plan selected" as an event but will // not include the "Plan: Premium" properties into your Goals. Mixpanel *mixpanel = [Mixpanel sharedInstance]; [mixpanel track:@"Plan selected" properties:@{ @"Plan": @"Premium" }]; .. code-tab:: swift iOS (Swift) :caption: iOS (Swift) // Apptimize auto-import is not supported if you are using the Mixpanel Swift library .. code-tab:: java Android (Java) :caption: Android (Java) // In this example, Apptimize will auto-import "Plan selected" as an event but will // not include the "Plan: Premium" properties into your Goals. MixpanelAPI mixpanel = MixpanelAPI.getInstance(context, MIXPANEL_TOKEN); JSONObject props = new JSONObject(); props.put("Plan", "Premium"); mixpanel.track("Plan Selected", props); In order for the import to take place, you will first need to trigger your events in a live experiment. We recommend running an A/A test in your app so that you can successfully have all existing events triggered, without affecting your end users. Once the experiment results are posted from your A/A test, you will see your Mixpanel Events listed as selectable goals for use in your future experiments. Mixpanel Events that have been automatically imported from Mixpanel will appear with the prefix "mp:" in your Goals like so: .. image:: mixpanel/mixpanel-events.png If you wish to have other specific events reflected in your Apptimize results, we recommend tracking manually with our :ref:`Apptimize track method ` where the event occurs. Importing Super Properties Automatically ================================================================================ Apptimize automatically imports Mixpanel Super Properties and allows you to :ref:`target with them in your Apptimize Experiments `. Super Properties are available for targeting, when you fire an event or reach a view that has an associated Mixpanel Super Property in your app while your device is paired with the Apptimize Dashboard. To pair with the Dashboard, open our :ref:`Preview Variants tool`, which will mirror your active device. Once you trigger the event or navigate to the view that contains registerSuperProperties, Apptimize will detect it and automatically import the property for use within Apptimize. Once you have successfully paired and fired your events, you will see your Super Properties as selectable options in the Target & Launch filter dropdown: .. image:: mixpanel/mixpanel-user-props.png You will also be able to filter by your Super Properties in your experiment's Results: .. image:: mixpanel/mixpanel-filter.png :scale: 45% Managing User Identity and Additional Properties ================================================================================ Apptimize does not currently automatically import your Mixpanel unique identifier; however, if you are using the Mixpanel identify method, we recommend integrating the latest version of the Apptimize SDK and using our :ref:`user identification methods` where you use the ``identify`` method as well. If there are any additional user profiles or properties you wish to use for targeting in Apptimize, feel free to set these up as :ref:`Custom Attributes `. Exporting Experiment Data ================================================================================ Apptimize maintains a TestInfo API which can be used to export Apptimize experiment results data to Mixpanel. .. seealso:: Links to the documentation of the TestInfo API - `iOS TestInfo API Reference `_ - `Android TestInfo API Reference `_ Calling TestInfo will return a map of the following info for all actively running tests: * Experiment Name * Variant Name * Experiment identifier * Variant identifier * Enrollment in Experiment Date * Start Experiment Date * User has Participated since Enrollment This data provides comprehensive detail around the user's experiment participation, and can be parsed and/or passed along to Mixpanel or any other third party as you please. As an example, your output might look like: .. code-block:: objective-c testinfo: { "New Experiment" = "Variant \"original\" (157581) of test \"New Experiment\" (11452), enrolled since 2015-06-06 01:15:56 +0000 (started on 2015-06-06 00:47:15 +0000)"; Experiment first participation events are automatically exported to the Mixpanel iOS Objective-C and Android SDKs. These events are labeled 'Apptimize experiment' and include a map with the following data: * Name * Variation * Name and Variation For other platforms, including the Mixpanel iOS Swift SDK, you can track these events manually by listening for 'OnParticipatedInExperimentNotification', which includes a flag indicating the users first participation. Additional experiment data is automatically exported as a profile attribute to the Mixpanel user. This attribute is labeled 'Apptimize experiment' and includes an array of all experiments that have been participated in with the format '-'. For additional details and sample implementation, please see our :ref:`Data Export documentation page. ` .. _mixpanel.cohort.targeting: Targeting cohorts ================================================================================ In common with :ref:`groups `, Mixpanel cohorts combine users that share similar features. Mixpanel cohorts may be targeted in experiments, too. Create a new token on the Apptimize dashboard: 1. Open an app and click ``Tokens``. #. Click ``New token``. #. In the dialog window that opens, enter a name for your token. #. Click ``Generate``. #. Copy the generated token. .. important:: Apptimize assigns the `user ID` to each Mixpanel user that can be identified. When the `user ID` is not specified or unknown, it is the *anonymous ID* that uniquely identifies the user. .. figure:: ../_res/graphics/mixpanel-dashboard.1.png A fragment of the Mixpanel dashboard showing the Apptimize User ID .. rubric:: Switch to Mixpanel and set up your integration with Apptimize: #. Log in to Mixpanel. #. Locate your Apptimize integration: |ui.data-m_ment.int_tions.apptimize|. #. Click :guilabel:`Connect` to connect to your Apptimize integration. #. When prompted, enter the token that you generated on the Apptimize dashboard. .. seealso:: Mixpanel Documentation: - `Setting up your cohorts in Mixpanel `_. .. rubric:: Have Mixpanel export the selected cohorts to Apptimize: #. Open your cohorts: |ui.data-m_ment.cohorts|. #. Select a cohort and click |b_n.mixpanel-context| to open its context menu. #. Export the cohort by clicking: |ui.export-to.apptimize|. #. In the dialog that opens, select if the export should be static (one time only) or dynamic (at predefined intervals). After a while, Mixpanel will start pushing your cohorts to Apptimize. Check the current status of all cohorts that you have selected to be exported on the Apptimize integration page in Mixpanel: |ui.data-management.int_tions.apptimize|. Switch to your Apptimize dashboard for the app which you plan to use Mixpanel cohorts as targets: 1. Click ``Groups``. #. In the search field, select ``Mixpanel cohorts``. The cohorts you set up in Mixpanel earlier will appear. .. note:: 1. Mixpanel cohort targeting is only available for client-side SDKs (Android, iOS, JavaScript, and React Native). #. You cannot change or remove Mixpanel cohorts on the Apptimize dashboard. .. rubric:: Mixpanel References - `iOS ObjectiveC Documentation `_ - Please note that the automatic import integration does not currently work with the Mixpanel Swift library - `Android Documentation `_ .. |b_n.mixpanel-context| image:: ../_res/graphics/b_n.mixpanel-context.png .. |ui.data-m_ment.cohorts| replace:: :menuselection:`Data Management --> Cohorts` .. |ui.data-management.cohorts| replace:: :menuselection:`Data Management --> Cohorts` .. |ui.export-to.apptimize| replace:: :menuselection:`Export to ... --> Apptimize` .. |ui.data-m_ment.int_tions.apptimize| replace:: :menuselection:`Data Management --> Integrations --> Apptimize` .. |ui.data-m_ment.integrations.apptimize| replace:: :menuselection:`Data Management --> Integrations --> Apptimize` .. |ui.data-management.int_tions.apptimize| replace:: :menuselection:`Data Management --> Integrations --> Apptimize`