Initial SDK Setup

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

Step 1: Get the SDK

iOS with rnpm

  1. Install the Appboy iOS SDK into your iOS project. See instructions for Cocoapods here. For manual integration, please check here. See notes below for further information.
  2. npm install react-native-appboy-sdk@latest --save
  3. rnpm link
Notes:
  • If you do a Cocoapods integration for the first time, you need to add $(inherited) to the Other linker flags configuration in your app.
  • If you do a manual integration, our library expects the AppboyKit folder to be under the root of the ios project directory.
  • We’ve also inserted the token APPBOY_LIBRARY_SEARCH_PATH in the header search path, so that folks who find the default paths insufficient and care replace that token can do so. If there are any standard search paths that you think would be universally applicable, please leave an issue on the repo or a pull request and we’ll update it.

iOS without rnpm

rpnm will automatically link the node package to your project. If you decide not to use it, follow these steps.

  1. Install the Appboy iOS SDK into your iOS project. See instructions for Cocoapods here. For manual integration, please check here. See notes below for further information.
  2. npm install react-native-appboy-sdk@latest --save
  3. In the Xcode’s “Project navigator”, right click on your project’s Libraries folder ➜ Add Files to <...>
  4. Go to node_modulesreact-native-appboy-sdkios ➜ select AppboyReactBridge.xcodeproj
  5. Add AppboyReactBridge.a to Build Phases -> Link Binary With Libraries
  6. Update the ‘Header Search Paths’ in the AppboyReactBridge Xcode project to reference the headers directory of your installation of the Appboy iOS SDK.

iOS completing the integration

  1. Follow the directions at https://www.appboy.com/documentation/ to finish your integration.
  2. When you need to make Appboy calls from javascript, use the following declaration to import the javascript module:
const ReactAppboy = require('react-native-appboy-sdk');

Analytics

Logging Custom Events

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

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

Setting Custom Attributes

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

ReactAppboy.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";
ReactAppboy.logPurchase("testPurchaseWithNullCurrency", 10, null, 5, properties);