Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

React Native Survicate Plugin


Survicate(link takes you to an external page) is an all-in-one customer feedback platform that helps you collect and act on feedback from your customers. It helps you understand your customers and improve their experience with your product or service.


Installation

installation page anchor

Install the @survicate/analytics-react-native-survicate and @survicate/react-native-survicate packages.

Using npm:

npm install --save @survicate/analytics-react-native-survicate @survicate/react-native-survicate

Using yarn:

yarn add @survicate/analytics-react-native-survicate @survicate/react-native-survicate

Configure iOS

configure-ios page anchor
  1. Add your Survicate workspace key to Info.plist.
1
<key>Survicate</key>
2
<dict>
3
<key>WorkspaceKey</key>
4
<string>*WORKSPACE_KEY*</string>
5
</dict>
  1. Run pod install in the ios directory.

Configure Survicate bindings for Android

configure-survicate-bindings-for-android page anchor
  1. Add the Maven repository to your project build.gradle located under android directory.
1
allprojects {
2
repositories {
3
// ...
4
maven { url 'https://repo.survicate.com' }
5
}
6
}
  1. Add your Survicate workspace key to AndroidManifest.xml.
1
<application
2
android:name=".MyApp"
3
>
4
<!-- ... -->
5
<meta-data android:name="com.survicate.surveys.workspaceKey" android:value="*WORKSPACE_KEY*"/>
6
</application>

Follow the instructions for adding plugins(link takes you to an external page) on the main Analytics client:

In the file where you initialize the Analytics client, call .add(plugin) with a SurvicatePlugin instance:

1
import { createClient } from '@segment/analytics-react-native';
2
3
import { SurvicatePlugin } from '@segment/analytics-react-native-plugin-survicate';
4
5
const segmentClient = createClient({
6
writeKey: 'SEGMENT_KEY'
7
});
8
9
segmentClient.add({ plugin: new SurvicatePlugin() });

Use the Survicate plugin

use-the-survicate-plugin page anchor

Identify

identify page anchor

The SurvicateDestination plugin maps Segment Identify events to Survicate's setUserTrait method. Inside the plugin's Identify function, the code extracts the traits object and userId from the incoming Identify payload and forwards them to Survicate. For each key–value pair in traits, the function calls setUserTrait(key,value). It also sends the userId as a trait by calling setUserTrait('userId',userId).

The SurvicateDestination plugin maps Segment Track events to the Survicate invokeEvent method. This means when you track an event in Segment, it will be invoked in Survicate.

The SurvicateDestination plugin maps the Segment Screen method to the Survicate enterScreen method. This means when you track a screen in Segment, it will be entered in Survicate.

The SurvicateDestination plugin maps the Segment Reset method to the Survicate reset method. This means when you reset the Segment client, the Survicate client will also be reset.