Initial SDK Setup

Installing the Appboy SDK will provide you with analytics functionality, as well as push and in-app messages.

Note: As of SDK version 2.1.0, use of the iOS SDK requires XCode 8 or above.

Step 1: Get the SDK

Download the SDK from github and run cordova plugin add path_to_repo/plugin/ from the root your project.

Alternatively, you could install directly from github, like cordova plugin add https://github.com/appboy/appboy-cordova-sdk#master:/plugin/

Configure the plugin

In your config.xml, add a preference element under the iOS platform element that contains your Appboy API key with the name com.appboy.api_key:

    <platform name="ios">
        <preference name="com.appboy.api_key" value="YOUR_API_KEY" />
        ...
    </platform>

Set up your applications to have the appropriate certificates for push, via the iOS push documentation.

Note: By default we instrument registering for push automatically in this SDK, so push is a 0-touch integration.

Removing automatic push setup (iOS)

If you want to turn off iOS automatic push registration, add the preference com.appboy.ios_disable_automatic_push_registration with a value of true.

Initial Setup Complete

Once the initial setup is complete, you can access the AppboyPlugin javascript interface in your app.

Push Notifications

If you use the Cordova SDK default setup you won’t have to make any new changes client-side. For modified integrations, see the iOS integration instructions.

In-App Messaging

By default the Cordova SDK supports in-app messages with no changes. See the iOS integration instructions for information on customizing in-app messages. Furthermore, you can look at the sample Cordova application or the sample iOS application for implementation samples.

Analytics

Setting User IDs

See the iOS integration instructions for an in depth discussion of when to set and change a user ID.

 AppboyPlugin.changeUser("YOUR_USER_ID");

Logging Custom Events

See the iOS integration instructions for in depth discussion of event tracking best practices and interfaces.

var properties = {};
properties["KeyOne"] = "Val1";
AppboyPlugin.logCustomEvent("cordovaCustomEventWithProperties", properties);

Setting Custom Attributes

See the iOS integration instructions for in depth discussion of attribute tracking best practices and interfaces.

AppboyPlugin.setFirstName("firstName");

Logging Purchases

See the iOS integration instructions for in depth discussion of revenue tracking best practices and interfaces.

var properties = {};
properties["KeyOne"] = "ValueOne";
AppboyPlugin.logPurchase("testPurchaseWithNullCurrency", 10, null, 5, properties);

News Feed

See the iOS integration instructions for information on how to integrate the news feed into your Cordova app. Alternatively, our Cordova plugin provides a method, launchNewsFeed, that will launch a modal news feed without further integration.

The Appboy Cordova SDK has several methods to get the number of read/unread News Feed cards for different categories. See our sample project implementation for an example.

You can look at the sample iOS application and sample Cordova application implementation samples.

Customer Feedback

See the iOS integration instructions for information on how to integrate the feedback form into your Cordova app. Alternatively, the Cordova plugin provides a launchFeedback method that will launch a modal feedback element over your application.

You can look at the sample iOS application and sample Cordova application implementation samples.

Setting a Custom API Endpoint

A custom API endpoint can be configured via the config.xml. For example, to use the EU endpoint, see the following:

    <platform name="ios">
        ...
        <preference name="com.appboy.ios_api_endpoint" value="sdk.api.appboy.eu" />
    </platform>