mParticle Integration: iOS

This document will guide you through setting up the Apptentive mParticle Kit through your existing mParticle integration. If you are not using mParticle, you should use the native integration documentation.

Please see our system requirements

Check out our example app.

1. Adding Apptentive to Your App

We support using mParticle with CocoaPods. In your podfile, add the Apptentive kit alongside the mParticle SDK:

pod 'mParticle-Apptentive'

2. Set Up Apptentive in the mParticle Dashboard

Add Output: Apptentive

  1. If you haven’t already, create an Apptentive account, and create a new iOS app in the Apptentive Dashboard
  2. In the mParticle Directory, click Apptentive
  3. Click +Add Apptentive to Setup
  4. Check the box Output: Event
  5. Click Add to Setup
  6. In the next screen, give your configuration the name iOS
  7. Using the values found in Apptentive’s API & Development page, fill in the Apptentive API Key and Apptentive API Signature fields
  8. Click Save

Connect iOS Input to the Apptentive Output

  1. In the mParticle menu, click Connections
  2. Under Available Inputs, click iOS
  3. Under Connected Outputs, click Connect Output
  4. Click Apptentive
  5. Select Configuration iOS
  6. Turn Status on to Sending
  7. Click Add Configuration
Note

There may be a delay of several minutes before this configuration is downloaded by mParticle, and Apptentive is enable in your app.

3. Configure Events

If you have already been using mParticle in your app, you will most likely have calls to the -logEvent: method on the mParticle singleton. These calls will be delegated through to Apptentive and the Event names you passed into -logEvent: will be available for segmentation and targeting of Apptentive Interactions. If you haven’t already logged events in your app, you should do so now.

4. Configure Apptentive Interactions

Interactions can be configured to be displayed when mParticle events are logged by following these instructions.

5. Message Center

A vital part of our product is the ability to talk to your customers using Message Center. The mParticle API doesn’t have a concept of feedback or messaging, so you will need to call into our native SDK directly.

if let apptentive = mParticle.sharedInstance().kitInstance(MPKitInstanceApptentive) {
    apptentive.presentMessageCenterFromViewController(viewController)
}

(viewController should be a view controller that is able to present a modal view controller).

You should find a place in your app where you can add a feedback button that will open Message Center. Because Apptentive may not be enabled via your mParticle dashboard, and because you may have disabled Message Center in the Apptentive dashboard, you should check for availability before you show your feedback button. Here is an example:

override func viewDidLoad() {
    if let apptentive = mParticle.sharedInstance().kitInstance(MPKitInstanceApptentive) where apptentive.canShowMessageCenter() {
        feedbackButton.enabled = true
    } else {
        feedbackButton.enabled = false
    }
}

6. Other Apptentive Features

Refer to the native Apptentive iOS SDK documentation for all other Apptentive features.

Updated on September 29, 2017

Was this article helpful?

Related Articles