Skip to content

Add Survicate Kotlin plugin #5599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ plugins:
url: https://cdn.filepicker.io/api/file/fb5lNYEhQoWnABOjynZ6
mark:
url: https://cdn.filepicker.io/api/file/kWmScDJ3SvK1QBZTChGQ
- name: Survicate
url: connections/sources/catalog/libraries/mobile/kotlin-android/destination-plugins/survicate-kotlin-android/
logo:
url: https://cdn.filepicker.io/api/file/BUciQq3kSzqCn8EKMtBN
mark:
url: https://cdn.filepicker.io/api/file/0H2JyPoRT4K3CnBQcHPn
- name: Quantcast
url: connections/sources/catalog/libraries/mobile/kotlin-android/destination-plugins/quantcast-kotlin-android/
logo:
Expand Down Expand Up @@ -139,4 +145,4 @@ To test your destination:
Segment recommends you to test your destination implementation end-to-end. Send some sample analytics events and ensure that they reach the destination.

> info ""
> For more information about the Analytics Kotlin Plugin architecture and how it can help you customize your tracking implementation to suit your needs, refer to the [Plugin Architecture Guide.](/docs/connections/sources/catalog/libraries/mobile/kotlin-android/kotlin-android-plugin-architecture)
> For more information about the Analytics Kotlin Plugin architecture and how it can help you customize your tracking implementation to suit your needs, refer to the [Plugin Architecture guide](/docs/connections/sources/catalog/libraries/mobile/kotlin-android/kotlin-android-plugin-architecture).
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Analytics Kotlin Survicate Plugin
strat: kotlin-android
---

[Survicate](https://survicate.com/){:target="_blank"} is an all-in-one customer feedback platform that helps you collect and act on feedback from your customers. With Survicate, you can better understand your customers and improve their experience with your product or service.

Add Survicate device mode support to your applications using [this plugin](https://github.com/segmentio/analytics-kotlin){:target="_blank"} for Analytics-Kotlin.

## Getting started

To get started, you need to provide a Survicate workspace key.

You can do this in two ways:

1. Add the key in the Segment panel. Navigate to **Connections > Destinations** and locate your Android app destination. Click **Settings**, then enter the key inside the Connection Settings as a "Workspace Key".

2. Alternatively, you can add your Survicate workspace key as metadata inside AndroidManifest:

```xml
<application
android:name=".MyApp"
>
<!-- ... -->
<meta-data android:name="com.survicate.surveys.workspaceKey" android:value="YOUR_WORKSPACE_KEY"/>
</application>
```

## Adding the dependency

To define the Maven repository:

```
allprojects {
repositories {
// ...
maven { url 'https://repo.survicate.com' }
}
}
```

Add the dependency to your app's build.gradle file:
```
dependencies {
// ...
implementation 'com.survicate:survicate-segment-analytics-kotlin:<latest_version>'
}
```

You can find the current version in the [plugin repository](https://github.com/Survicate/analytics-kotlin-survicate){:target="_blank"}.

## Using the plugin in your app
In order to activate the Survicate plugin, you have to add a `SurvicateDestination` to the Analytics instance.

```kotlin
analytics = Analytics(segmentKey, applicationContext) {
// ...
}
analytics.add(SurvicateDestination(applicationContext))
```

Only keep one instance of the `Analytics` (for example, initialize it inside the application's `onCreate` method). This is important because the Survicate SDK underneath can only be initialized once.

Now you can use the Analytics, having the events mapped to the Survicate SDK as described below.

#### Identify

In the SurvicateDestination plugin, the Identify method from Segment is transferred to the `setUserTraits` method of Survicate. You can provide multiple key-value pairs. The `userId` argument of `Analytics.identify` is also set as a user trait with the key "user_id".

#### Track

The Track method from Segment is used as the `invokeEvent` method in Survicate. This means that when you track an event in Segment, it will be invoked in Survicate.

#### Screen

Similarly, the Screen method from Segment is used as the `enterScreen` method in Survicate. This means that when you track a screen in Segment, it will be entered in Survicate.

#### Reset

The Reset method from Segment is used as the reset method in Survicate. This means that when you reset the Segment client, the Survicate client is also reset.