Survicate React Native SDK
Requirements:
- Using Survicate Mobile SDK requires an account at survicate.com. You can create your account here for free, or become invited to your company account by one of your colleagues.
- Your React Native application has to use React Native CLI. The Survicate Mobile SDK can't be used in Expo Go.
- Additionally, please check iOS and Android library requirements, as they're applicable too.
Installation
Mobile SDK is compatible with React Native apps. Use these React Native bindings to install Mobile SDK in your app.
To install run:
npm install @survicate/react-native-survicate --save
To create linking for iOS and Android in your react native app run react-native link @survicate/react-native-survicate
Note: Our bindings are compatible with the Autolinking feature introduced in React Native 0.60, so there is no need to run this command on 0.60 and newer versions.
Configuration
Configuration for Android
- Configure your workspace key in
AndroidManifest.xml
file. - Add the Survicate Maven repository to your project
build.gradle
located underandroid
directory.
Configuration for iOS
- Add workspace key to your
Info.plist
file.- Create
Survicate
Dictionary. - Define
WorkspaceKey
String inSurvicate
Dictionary. YourInfo.plist
file should looks like this:
- Create
- Run
pod update
in yourios
directory.
Initialization
Initialize the SDK in your application using initialize()
method. Call this method only once, in the main component (e.g src/App.js
file).
Using SDK
Survicate allows you to launch precisely targeted surveys inside your app. In the Survicate Panel, you can set conditions that need to be met for the surveys to appear. Users matching conditions defined in the Survicate panel will see the survey automatically. Here's a list of conditions you can use to target your surveys:
- Name of the screen that a user currently sees
- Any application event
- User attributes and identities
- Language of the device
- Operating system
Make sure to list all the screens and events described in your application. Once you got this covered, you or any person responsible for creating and managing surveys will be able to trigger surveys from the Survicate panel with no need for you to update the application.
Targeting a survey by screen name
A survey can appear when a user is viewing a specific screen. For example, a survey can be triggered to show up on the application's home screen after a user spends more than ten seconds there. To set it up, you need to send information to Survicate about the user entering and leaving a screen.
Note: Multiple active screens are allowed. In specific, calling enterScreen() does not make the previous screen to be discarded. Be sure to call leaveScreen() when you no longer want the screen to be treated as active.
Screen name is case sensitive. If there's any discrepancy between what's declared in the ‘Screens’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
Events-based survey targeting
Survicate Android SDK allows you to launch surveys based on events your users trigger in your app. Your survey will instantly after an event occurs in your app.
Event name is case sensitive. If there is any discrepancy between what's declared in the ‘Triggers’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
Passing user attributes
You can pass user attributes to Survicate as an additional layer of information about your users. Attributes can be used to:
- trigger your surveys
- filter your survey results
Bear in mind that user attributes are cached. You only need to provide them once, e.g. when user logs in, not after each init()
. You can also change their values at any time to trigger a survey.
Reseting user data for testing purposes
If you need to test surveys on your device, reset()
method might be helpful. This method will reset all user data stored on your device (survey views, attributes, information about answered surveys for the targeting engine).
Changelog
2.1.0 (2023-04-07)
- Update
- Bumping up references: Android to 2.1.0 and iOS to 2.1.0
2.0.0 (2023-03-10)
- Update
- Bumping up references: Android to 2.0.0 and iOS to 2.0.0
1.1.19 (2023-01-09)
- Update
- Bumping up references: Android to 1.7.5 and iOS to 1.8.7
1.1.18 (2022-11-23)
- Update
- Bumping up references: iOS to 1.8.5
1.1.17 (2022-11-17)
- Update
- Bumping up references: Android to 1.7.4 and iOS to 1.8.4
1.1.16 (2022-09-12)
- Fix
- build.gradle file cleanup to fix gradle sync.
1.1.15 (2022-09-07)
- Update
- Bumping up references: Android to 1.7.0
- Update
- The minimum supported version of Android changed to 5 (API 21).
1.1.13 (2022-08-05)
- Update
- Bumping up references: iOS to 1.8.2
1.1.12 (2022-08-04)
- Update
- Bumping up references: Android to 1.6.5
1.1.11 (2022-07-01)
- Update
- Bumping up references: Android to 1.6.1 and iOS to 1.8.0
- Fixed
- Gradle sync failure if referring to React Native 0.68.* and using gradle version lower than 7.2.*
1.1.10 (2022-06-03)
- Update
- Bumping up references: Android to 1.6.1 and iOS to 1.8.0
1.1.9 (2022-04-29)
- Update
- Bumping up references: Android to 1.5.14 and iOS to 1.7.2
1.1.8 (2022-04-11)
- Update
- Bumping up references: iOS to 1.7.1
1.1.7 (2022-03-28)
- Update
- React version dependency rule, to allow higher version than 16.8.1
1.1.6 (2022-03-23)
- Update
- Bumping up references: Android to 1.5.12 and iOS to 1.6.7
- Fixed
- Clean up
build.gradle
file for fixing Android build issues.
1.1.5 (2022-03-03)
- New
- Use
maven-publish
to support React Native 0.67.1 - Update
- Bumping up references: Android to 1.5.9 and iOS to 1.6.5
1.1.4 (2022-01-20)
- Update
- Bumping up references: Android to 1.5.6
1.1.3 (2022-01-17)
- Update
- Bumping up references: Android to 1.5.5
1.1.2 (2021-12-9)
- Update
- Bumping up references: Android to 1.5.2 and iOS to 1.6.1
1.1.1 (2021-11-10)
- Update
- Bumping up references: Android to 1.4.5 and iOS to 1.5.8
1.1.0 (2021-10-29)
- Update
- Bumping up references: Android to 1.3.0 and iOS to 1.5.5
- Update
- Survicate iOS SDK is now distributed as an XCFramework binary
1.0.5 (2021-05-04)
- Update
- Bumping up references: Android to 1.2.6
1.0.3 (2021-02-04)
- Update
- Bumping up references: Android to 1.2.4 and iOS to 1.4.3
1.0.2 (2020-04-23)
- Update
- Bumping up references: Android to 1.2.0 and iOS to 1.4.0
1.0.1 (2020-03-06)
- Update
- Bumping up references: Android to 1.1.2
1.0.0 (2020-01-24)
- New
- Initial version of the SDK, with references to the native Survicate SDKs as follows: Android - 1.0.19 and iOS to 1.3.0