.. _events_and_funnels: Events & Funnels ^^^^^^^^^^^^^^^^ :supported-text:`Supported on` |ios-logo| |android-logo| |rest-logo| |react-logo| |js-logo| |java-logo| |node-logo| |python-logo| |roku-logo| Events are any user activity within an app that is tracked through Apptimize or your analytics provider, and automatically import into the Apptimize dashboard. A Goal is an experiment-specific metric, and is composed of either a single event or a series of events combined into a funnel. Goals are unique to each experiment, but events and funnels are created on the app level, and can be used as Goals across multiple experiments. See :ref:`Details & Goals ` for more information on selecting goals for a specific experiment. If you aren’t using a third-party analytics provider to track your events, you can create and track events through Apptimize. This guide details how to: * Setup :ref:`Visual Events ` in Apptimize without coding * Setup :ref:`Programmatic Events ` in Apptimize * :ref:`Automatically Import ` events from your analytics provider * Create :ref:`Funnels ` from your events * Create :ref:`Bundles ` of events and funnels to add them to experiments with one click * Integrate :ref:`Events with values ` to Apptimize .. _apptimize_events_visual: Apptimize Events: Visual ------------------------ Visual events can be created for native mobile platforms by pairing your app with the Events dashboard, and selecting visual elements on your app’s page to track. Visual elements can either track button clicks or page views. To create a Visual Event, simply name the event and select the element through the visual editor. Once the event has been created, it will automatically be added to the Events list. .. image:: events-and-funnels/Visual-Events.png .. _apptimize_events_programmatic: Apptimize Events: Programmatic ------------------------------ Programmatic Events can be instrumented by integrating a code snippet into your app’s codebase. We can track anything you want including actions with values. Examples of events you could track include purchases being made, login events, and Facebook shares. If there is a numeric value associated with this event that you’d like to track and view at apptimize.com, provide it as the input parameter value. For example, if the event is a purchase, the value might be the price. To create a Programmatic Event, simply name the event in the Apptimize dashboard and we will generate a short code snippet for you to embed into your app: .. tabs:: .. code-tab:: java Android (Java) :caption: Android Apptimize.track("event-name"); Apptimize.track("event-name", 123.12); .. code-tab:: kotlin Android (Kotlin) :caption: Android (Kotlin) val userId = "1234abcd"; Apptimize.track("event-name", userId); Apptimize.trackValue("event-name", 123.12, userId); // note that you must use trackValue for events with a double value .. code-tab:: objectivec Objective C :caption: iOS (Objective-C) [Apptimize track:@"event name"]; [Apptimize track:@"event-name" value:]; .. code-tab:: swift Swift :caption: iOS (Swift) Apptimize.track("event-name") Apptimize.track("event-name", value: ) .. code-tab:: javascript JavaScript :caption: JavaScript Apptimize.track("event-name"); Apptimize.trackValue("event-name", 123.12); // note that you must use trackValue for events with a double value .. code-tab:: js Node.js :caption: Node.js var userId = "1234abcd"; Apptimize.track("event-name", userId); Apptimize.trackValue("event-name", 123.12, userId); // note that you must use trackValue for events with a double value .. code-tab:: python Python :caption: Python 3 userId = "1234abcd" Apptimize.track("event-name", userId) Apptimize.trackValue("event-name", 123.12, userId) # note that you must use trackValue for events with a double value .. code-tab:: bash Rest API :caption: Rest API curl -X POST \ -H "ApptimizeApiToken: " \ https://api.apptimize.com/v1/users/1234abcd/events/event-name curl -X POST \ -H "ApptimizeApiToken: " \ -F "value=123.12" \ https://api.apptimize.com/v1/users/1234abcd/events/event-name .. code-tab:: text Roku :caption: Roku userId = "1234abcd" m.requestId = m.apptimize.callFunc("track", {userid: userId, name: "event-name", customAttributes: {}}) m.requestId = m.apptimize.callFunc("track", {userid: userId, name: "event-name", value: 123.12, customAttributes: {}}) ' Requires setup of setcontent callback as described in Roku installation steps function setcontent(message as object) apptimizeResponse = message.getData() if (apptimizeResponse.id = m.requestId) then ?"Track Event posted";apptimizeResponse.success end if end function .. _analytics_auto_import: Analytics Auto-Import --------------------- If your mobile app currently uses Amplitude, Firebase, Flurry, Google Analytics, Localytics, Mixpanel or Omniture (Adobe Marketing Cloud), all of your analytics events can be automatically sent to Apptimize. If you use another analytics provider that we don’t support right now, please `contact us `_. See :ref:`Integrations ` for more detailed information. To import your analytics events, enable one or more analytic integrations on the Manage -> Integrations page. Then, simply launch your first experiment. As soon as your users interact with the app we will detect any analytics events as they are triggered and send a copy of the event data to Apptimize. You can also see your list of events and use them to create funnels under the "Manage" tab. You can also view these imported events on your Result and Goals pages – just click "Create Goal" and you’ll see a dropdown option for each of your analytics providers. .. image:: events-and-funnels/Goals-Modal.png Apptimize is **case-insensitive** when processing and analyzing events. If you are sending in "Checkout" event and also a "checkout" event, Apptimize will treat both as the same event. Please make sure you follow a case-insensitive event schema with Apptimize. *Note: Imported events will appear in your list prefixed by where they came from. For example, Google Analytic events begin with "ga" and Mixpanel events begin with "mp". Auto-imported events are treated similarly to Apptimize events. Metrics such as conversion rate are computed the same way from both Apptimize and auto-imported events.* .. _funnels: Funnels ------- To measure Goals with multiple events, you can create a Funnel. Funnels track a series of events that users can take, such as completing an onboarding flow, or completing a checkout flow. To create a Funnel, select "Create Funnel" under the Manage tab, and drag and drop your existing Events on the left into the Funnel Events on the right. Once the Funnel events have been added, you can drag and rearrange the order of the events as necessary. .. image:: events-and-funnels/Create-Funnel.png .. _bundles: Goal Bundles ------------ Do you have a list of general product metrics to track for every experiment? Do you want to effortlessly add a similar list of goals to every onboarding experiment? If so, Goal Bundles is the perfect tool for you. Bundles are lists of goals that you can add to any experiment with one click. To create a bundle, select "Bundle Events" in the Manage -> Goals tab. Similar to Funnels, you can drag and drop the desired goals into the bundle. Bundles can contain events and funnels at the same time, but not other bundles. .. image:: events-and-funnels/Bundles-Manage-Goals.jpeg Once you create a Goal Bundle, it will appear in the top section of the Add Goal modal. You can add the entire bundle of goals clicking "Add all", or any of the individual goals inside the bundle clicking "Add". After you’ve added a bundle of goals to your experiment, you can edit or delete the bundle without affecting results calculation or your results dashboard. .. image:: events-and-funnels/Bundles-Add-Bundles.jpeg .. _events_with_values: Integrate Events With Values to Apptimize ----------------------------------------- Apptimize currently support events with one value attribute. There are 3 ways to get events with values to Apptimize: #. Apptimize SDK method: trackEvent + value #. Localytics SDK method: tagEvent + customerValueIncrease #. Amplitude SDK method: logRevenue **1. Apptimize** To directly send Apptimize events with value data, add code like this to your application: .. tabs:: .. code-tab:: java Android (Java) :caption: Android (Java) Apptimize.track("event-name", 123.12); .. code-tab:: kotlin Android (Kotlin) :caption: Android (Kotlin) String userId = "1234abcd"; Apptimize.trackValue("event-name", 123.12, userId); .. code-tab:: objectivec iOS (Objective C) :caption: iOS (Objective-C) [Apptimize track:@"event-name" value:123.12]; .. code-tab:: swift iOS (Swift) :caption: iOS (Swift) Apptimize.track("event-name", value: 123.12) .. code-tab:: javascript JavaScript :caption: JavaScript Apptimize.trackValue("event-name", 123.12); .. code-tab:: js Node.js :caption: Node.js var userId = "1234abcd"; Apptimize.trackValue("event-name", 123.12, userId); .. code-tab:: python :caption: Python 3 userId = "1234abcd" Apptimize.trackValue("event-name", 123.12, userId) .. code-tab:: bash Rest API :caption: API curl -X POST \ -H "ApptimizeApiToken: " \ -F "value=123.12" \ https://api.apptimize.com/v1/users/1234abcd/events/event-name .. code-tab:: text Roku :caption: Roku userId = "1234abcd" m.requestId = m.apptimize.callFunc("track", {userid: userId, name: "event-name", value: 123.12, customAttributes: {}}) **2. Amplitude** To send Apptimize events with value data via Amplitude (mobile only), add code like this to your application: .. tabs:: .. code-tab:: java Android (Java) :caption: Android (Java) Amplitude.getInstance().logRevenue("com.product.id", 1, 123.12, "", ""); .. code-tab:: objectivec iOS (Objective C) :caption: iOS (Objective-C) [[Amplitude instance] logRevenue:"com.product.id" quantity:1 price:@123.12 receipt:nil]; .. code-tab:: swift iOS (Swift) :caption: iOS (Swift) Amplitude.instance().logRevenue("com.product.id", quantity: 1, price: 123.12, receipt: nil) *Note: the newer LogRevenueV2 amplitude methods will be imported to Apptimize as events but the value data will not be available for results beyond conversion metrics.* **3. Localytics** To send Apptimize events with value data via Localytics (mobile only), add code like this to your application. The customerValueIncrease value will be used in Apptimize for results beyond conversion metrics. .. tabs:: .. code-tab:: java Android (Java) :caption: Android (Java) Map values = new HashMap(); values.put("Item name", "Stickers"); values.put("Aisle", "Knick-Knacks"); Localytics.tagEvent("Item Purchased", values, 499); .. code-tab:: objectivec iOS (Objective C) :caption: iOS (Objective-C) [Localytics tagEvent:@"Item Purchased" attributes:@{@"Item Name":@"Stickers", @"Aisle":@"Knick-Knacks"} customerValueIncrease:@499]; .. code-tab:: swift iOS (Swift) :caption: iOS (Swift) Localytics.tagEvent("Item Purchased", attributes: ["Item Name":"Stickers", "Aisle":"Knick-Knacks"], customerValueIncrease:499) When analyzing values per user or values per occurrence, Apptimize ignores events that were sent in with empty values. This is because certain events that are supposed to have values may be triggered with empty values by accident. For instance, when Appstore purchase confirmation is delayed, the tracking event sent in at the time may have empty values. Apptimize ignores these empty values to avoid skewing the data. .. include:: /_res/replace/icons.rsti