- Add content of the iOS directory to your Assets/Plugins/iOS
- Add SurvicatePluginIOS.cs and file inside your Assets/Plugins
- Download the latest iOS SDK from here. Copy this file to your xcode project folder.
Inside your exported Xcode project, on Build Phases -> Link Binary With Libraries, add
- survicate.xcframework
- Add content of the Android directory to your Assets/Plugins/Android
- Add SurvicatePluginAndroid.cs file inside your Assets/Plugins
- Define
https://repo.survicate.com
Maven repository in the project - Add Survicate SDK dependency to your app's
build.gradle
file.
- Configure your workspace key in
AndroidManifest.xml
file.
<application
android:name=".MyApp"
>
<!-- ... -->
<meta-data android:name="com.survicate.surveys.workspaceKey" android:value="YOUR_WORKSPACE_KEY"/>
</application>
- Define
https://repo.survicate.com
Maven repository in one of the following ways:
// settingsTemplate.gradle
dependencyResolutionManagement {
// ...
repositories {
// ...
maven { url 'https://repo.survicate.com' }
}
}
// mainTemplate.gradle
allprojects {
repositories {
// ...
maven { url 'https://repo.survicate.com' }
}
}
- Add Survicate SDK dependency to your app's
build.gradle
file.
// mainTemplate.gradle
dependencies {
// ...
implementation 'com.survicate:survicate-sdk:latest.release'
}
- Add workspace key to your
Info.plist
file. - Run
pod update
in yourios
directory.
Initialize the SDK in your application using initializeSdk()
method. Call this method only once, in the main script of your project.
On your C# script, import
using Plugins.Survicate;
Survicate.SetWorkspaceKey("your_workspace_key");
Survicate.Initialize();
Survicate.EnterScreen("your_screen_key");
Survicate.LeaveScreen("your_screen_key");
Survicate.InvokeEvent("your_event_name");
Dictionary<string, string> eventProperties = new Dictionary<string, string>();
eventProperties.Add("property1", "value1");
eventProperties.Add("property2", "value2");
Survicate.InvokeEvent("your_event_name", eventProperties);
Survicate.SetUserTrait(new UserTrait("name", "John"));
Survicate.SetUserTrait(new UserTrait("age", 25));
Survicate.SetUserTrait(new UserTrait("count", 0.1));
Survicate.SetUserTrait(new UserTrait("isActive", true));
Survicate.SetUserTrait(new UserTrait("birthDate", DateTime.Now));
Survicate.Reset();
SurvicateEventListener survicateEventListener = new SurvicateEventListener(
(SurveyDisplayedEvent event) => /* implement action */,
(QuestionAnsweredEvent event) => /* implement action */,
(SurveyClosedEvent event) => /* implement action */,
(SurveyCompletedEvent event) => /* implement action */
);
Survicate.AddSurvicateEventListener(survicateEventListener);
Survicate.RemoveSurvicateEventListener(survicateEventListener);