Initial SDK Setup

Installing the Braze 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 Braze 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 Braze 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 Braze iOS SDK.

iOS completing the integration

  1. Follow the directions at https://www.braze.com/documentation/ to finish your integration.
  2. When you need to make Braze 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);

Customer Feedback

The Customer Feedback module has been deprecated and is not available to new integrations.

See the iOS integration instructions for information on how to integrate the feedback form into your React Native iOS app. Alternatively, the React 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 React Native application implementation samples.