Integrate Survicate into your React Native application to collect user feedback seamlessly.
- iOS at least on version 12.0
- Android at least on version 5
- React Native at least on version 0.60.0
This package can be installed using npm or yarn. If you're using Expo, follow the Expo-specific instructions.
npm install @survicate/react-native-survicate --save
yarn add @survicate/react-native-survicate
Please note that due to custom native code in this package "Expo Go" is not available.
To use @survicate/react-native-survicate in an Expo managed project use npm, yarn or expo-cli.
expo install @survicate/react-native-survicate
- Add your Survicate workspace key to
Info.plist
<key>Survicate</key>
<dict>
<key>WorkspaceKey</key>
<string>YOUR_WORKSPACE_KEY</string>
</dict>
- run command
pod install
in yourios
directory
- Add maven repository to your project
build.gradle
located underandroid
directory
allprojects {
repositories {
// ...
maven { url 'https://repo.survicate.com' }
}
}
- Add your Survicate workspace key to
AndroidManifest.xml
<application
android:name=".MyApp"
>
<!-- ... -->
<meta-data android:name="com.survicate.surveys.workspaceKey" android:value="YOUR_WORKSPACE_KEY"/>
</application>
- Add config plugin to
plugins
array of yourapp.json
orapp.config.js
{
"expo": {
"plugins": [
[
"@survicate/react-native-survicate",
{
"workspaceKey": "YOUR_WORKSPACE_KEY"
}
]
]
}
}
Please note that every time you change the props or plugins, you'll need to rebuild the native app.
import Survicate, {UserTrait} from '@survicate/react-native-survicate';
Survicate.initializeSdk();
Survicate.setWorkspaceKey('WORKSPACE_KEY');
Survicate.invokeEvent("eventName");
const properties = {
"property1": "value1",
"property2": "value2"
};
Survicate.invokeEvent("eventName", properties);
Survicate.enterScreen("screenName");
Survicate.leaveScreen("screenName");
const userIdTrait = new UserTrait('user_id', 'id');
Survicate.setUserTrait(userIdTrait);
const textTrait = new UserTrait('name', 'John');
const numberTrait = new UserTrait('age', 25);
const booleanTrait = new UserTrait('isPremium', true);
const dateTrait = new UserTrait('lastLogin', new Date());
const timeIntervalTrait = new UserTrait('timeOfPurchase', new Date());
const listener: SurvicateEventListener = {
onSurveyDisplayed(event: SurveyDisplayedEvent) {},
onQuestionAnswered(event: QuestionAnsweredEvent) {},
onSurveyClosed(event: SurveyClosedEvent) {},
onSurveyCompleted(event: SurveyCompletedEvent) {},
}
const subscription = Survicate.addSurvicateEventListener(listener);
Survicate.reset();
Got an Issue?
To make things more streamlined, we’ve transitioned our issue reporting to our customer support platform. If you encounter any bugs or have feedback, please reach out to our customer support team. Your insights are invaluable to us, and we’re here to help ensure your experience is top-notch!
Contact us via Intercom in the application, or drop us an email at: [hello@survicate.com]
Thank you for your support and understanding!
The Survicate Mobile SDK change log can be found here