Skip to content

Commit 9441f2f

Browse files
authored
Merge pull request #5599 from dariusz-survicate/analytics-kotlin-survicate-docs
Add Survicate Kotlin plugin
2 parents fa1449b + 5418f30 commit 9441f2f

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

src/connections/sources/catalog/libraries/mobile/kotlin-android/destination-plugins/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ plugins:
6969
url: https://cdn.filepicker.io/api/file/fb5lNYEhQoWnABOjynZ6
7070
mark:
7171
url: https://cdn.filepicker.io/api/file/kWmScDJ3SvK1QBZTChGQ
72+
- name: Survicate
73+
url: connections/sources/catalog/libraries/mobile/kotlin-android/destination-plugins/survicate-kotlin-android/
74+
logo:
75+
url: https://cdn.filepicker.io/api/file/BUciQq3kSzqCn8EKMtBN
76+
mark:
77+
url: https://cdn.filepicker.io/api/file/0H2JyPoRT4K3CnBQcHPn
7278
- name: Quantcast
7379
url: connections/sources/catalog/libraries/mobile/kotlin-android/destination-plugins/quantcast-kotlin-android/
7480
logo:
@@ -139,4 +145,4 @@ To test your destination:
139145
Segment recommends you to test your destination implementation end-to-end. Send some sample analytics events and ensure that they reach the destination.
140146

141147
> info ""
142-
> 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)
148+
> 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 numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Analytics Kotlin Survicate Plugin
3+
strat: kotlin-android
4+
---
5+
6+
[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.
7+
8+
Add Survicate device mode support to your applications using [this plugin](https://github.com/segmentio/analytics-kotlin){:target="_blank"} for Analytics-Kotlin.
9+
10+
## Getting started
11+
12+
To get started, you need to provide a Survicate workspace key.
13+
14+
You can do this in two ways:
15+
16+
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".
17+
18+
2. Alternatively, you can add your Survicate workspace key as metadata inside AndroidManifest:
19+
20+
```xml
21+
<application
22+
android:name=".MyApp"
23+
>
24+
<!-- ... -->
25+
<meta-data android:name="com.survicate.surveys.workspaceKey" android:value="YOUR_WORKSPACE_KEY"/>
26+
</application>
27+
```
28+
29+
## Adding the dependency
30+
31+
To define the Maven repository:
32+
33+
```
34+
allprojects {
35+
repositories {
36+
// ...
37+
maven { url 'https://repo.survicate.com' }
38+
}
39+
}
40+
```
41+
42+
Add the dependency to your app's build.gradle file:
43+
```
44+
dependencies {
45+
// ...
46+
implementation 'com.survicate:survicate-segment-analytics-kotlin:<latest_version>'
47+
}
48+
```
49+
50+
You can find the current version in the [plugin repository](https://github.com/Survicate/analytics-kotlin-survicate){:target="_blank"}.
51+
52+
## Using the plugin in your app
53+
In order to activate the Survicate plugin, you have to add a `SurvicateDestination` to the Analytics instance.
54+
55+
```kotlin
56+
analytics = Analytics(segmentKey, applicationContext) {
57+
// ...
58+
}
59+
analytics.add(SurvicateDestination(applicationContext))
60+
```
61+
62+
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.
63+
64+
Now you can use the Analytics, having the events mapped to the Survicate SDK as described below.
65+
66+
#### Identify
67+
68+
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".
69+
70+
#### Track
71+
72+
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.
73+
74+
#### Screen
75+
76+
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.
77+
78+
#### Reset
79+
80+
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.

0 commit comments

Comments
 (0)