Skip to content

Commit acebd83

Browse files
authored
improve docs around plugins and make things more accessible via links (#48)
1 parent 98a68b8 commit acebd83

File tree

5 files changed

+40
-11
lines changed

5 files changed

+40
-11
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ NOTE: If you use pure Java codebase, please refer to [Java Compatibility](JAVA_C
4949

5050
You can find usage documentation at [https://segment.com/docs/sources/mobile/kotlin-android/](https://segment.com/docs/sources/mobile/kotlin-android/).
5151

52+
Explore more via the [example projects](samples) which showcase analytics instrumentation on different platforms/languages and usage of plugins. These projects contain sample [plugins](samples/kotlin-android-app/src/main/java/com/segment/analytics/next/plugins) and [destination plugins](samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins)
53+
5254
## Contributing
5355

5456
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

samples/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Sample Projects using analytics-kotlin
2+
3+
- [Java Android Application](java-android-app)
4+
A sample project showcasing the usage of `analytics-kotlin` in a pure java codebase Android application
5+
6+
- [Kotlin Android Application](kotlin-android-app)
7+
A sample project showcasing the usage of `analytics-kotlin` in a pure kotlin codebase Android application. Also contains sample plugins that are commonly used.
8+
9+
- [Kotlin Android Application w/ Sample Destination Plugins](kotlin-android-app-destinations)
10+
A sample project showcasing the usage of `analytics-kotlin` in a pure kotlin codebase Android application. This project also hosts sample Destination plugins, and instructions on how to include them in your own projects
11+
12+
- [Kotlin JVM Application](kotlin-jvm-app)
13+
A sample project showcasing the usage of `analytics-kotlin` in a pure kotlin codebase JVM application.

samples/kotlin-android-app-destinations/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
This is a sample android app that uses the `analytics-kotlin` library and the new `Plugins` concepts. It is meant to be simplistic, and easy to understand all the while showcasing the power of the analytics-kotlin library
33

44
## Plugins
5-
- [Amplitude Session](https://github.com/segmentio/analytics-kotlin/blob/master/samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins/AmplitudeSession.kt)
5+
- [Amplitude Session](src/main/java/com/segment/analytics/destinations/plugins/AmplitudeSession.kt)
66
Sample plugin to enable users to enrich data for the Amplitude Actions destination
77

8-
- [Firebase](https://github.com/segmentio/analytics-kotlin/blob/master/samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins/FirebaseDestination.kt)
8+
- [AppsFlyer](src/main/java/com/segment/analytics/destinations/plugins/AppsflyerDestination.kt)
9+
Sample plugin to enable users to send data to the device-mode AppsFlyer destination
10+
11+
- [Comscore](src/main/java/com/segment/analytics/destinations/plugins/ComscoreDestination.kt)
12+
Sample plugin to enable users to send data to the device-mode Comscore destination
13+
14+
- [Firebase](src/main/java/com/segment/analytics/destinations/plugins/FirebaseDestination.kt)
915
Sample plugin to enable users to send data to the device-mode Firebase destination
1016

11-
- [Intercom](https://github.com/segmentio/analytics-kotlin/blob/master/samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins/IntercomDestination.kt)
17+
- [Intercom](src/main/java/com/segment/analytics/destinations/plugins/IntercomDestination.kt)
1218
Sample plugin to enable users to send data to the device-mode Intercom destination
1319

14-
- [Mixpanel](https://github.com/segmentio/analytics-kotlin/blob/master/samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins/MixpanelDestination.kt)
20+
- [Mixpanel](src/main/java/com/segment/analytics/destinations/plugins/MixpanelDestination.kt)
1521
Sample plugin to enable users to send data to the device-mode Mixpanel destination
1622

17-
- [Webhook Plugin](https://github.com/segmentio/analytics-kotlin/blob/master/samples/kotlin-android-app-destinations/src/main/java/com/segment/analytics/destinations/plugins/WebhookPlugin.kt)
23+
- [Webhook Plugin](src/main/java/com/segment/analytics/destinations/plugins/WebhookPlugin.kt)
1824
An after plugin that allows you to send the event from the analytics timeline to a webhook of your choice. Ideal for debugging payloads in an internal network.

samples/kotlin-android-app/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
This is a sample android app that uses the `analytics-kotlin` library and the new `Plugins` concepts. It is meant to be simplistic, and easy to understand all the while showcasing the power of the analytics-kotlin library
33

44
## Plugins
5-
- Android AdvertisingId Plugin
5+
- [Android AdvertisingId Plugin](src/main/java/com/segment/analytics/next/plugins/AndroidAdvertisingIdPlugin.kt)
66
Using the `play-services-ads` library this plugin adds the `advertisingId` to all payloads (under the `context` key) going through the analytics timeline
77

8-
- Android Record Screen Plugin
8+
- [Android Record Screen Plugin](src/main/java/com/segment/analytics/next/plugins/AndroidRecordScreenPlugin.kt)
99
Using the application lifecycle, this plugin automatically sends `Screen` events through the analytics timeline, on Activity start
1010

11-
- Consent Tracking
11+
- [Consent Tracking](src/main/java/com/segment/analytics/next/plugins/ConsentTracking.kt)
1212
Presents user with a dialog to consent to tracking. If consent is given, any queued events will be sent out to the analytics timeline. If consent is not given, all queued events and future events will be dropped
1313
** Note: You will have to switch to the `ConsentActivity` inside of AndroidManifest.xml to view this feature **
1414

15-
- Webhook Plugin
16-
A destination plugin that allows you to send the event from the analytics timeline to a webhook of your choice. Ideal for debugging payloads in an internal network.
15+
- [Push Notification Tracking](src/main/java/com/segment/analytics/next/plugins/PushNotificationTracking.kt)
16+
Using Firebase Service for push notifications this plugin hooks into the activity start lifecycle method and fires Push Notification track events.
1717

1818
## Tracking Deep Links
1919
The sample app is configured to open links with the schema and hostname `https://segment-sample.com`
@@ -23,7 +23,7 @@ Here is how you can do it via adb
2323
adb shell am start -W -a android.intent.action.VIEW -d "https://segment-sample.com?utm_source=cli\&utm_click=2" com.segment.analytics.next
2424
```
2525

26-
## FCM
26+
## Firebase Cloud Messaging
2727
This project is setup to track push notification received and opened events. This code is strictly optional and must be customized as per your needs. The code here is only for demonstration purposes
2828
### Setup
2929
- Add your FCM project's `google-services.json` to this folder

samples/kotlin-android-app/src/main/java/com/segment/analytics/next/plugins/PushNotificationTracking.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import com.segment.analytics.kotlin.android.plugins.AndroidLifecycle
88
import kotlinx.serialization.json.buildJsonObject
99
import kotlinx.serialization.json.put
1010

11+
/**
12+
* Used alongside with MyFirebaseService.kt
13+
*
14+
* Firebase Service handles the incoming push notification and fires the Push Notification Received event,
15+
* if we choose to create a notification based on the incoming push, then this plugin will act upon the
16+
* opening of that notification and fire the Push Notification Tapped event.
17+
*/
18+
1119
object PushNotificationTracking: Plugin, AndroidLifecycle {
1220
override val type: Plugin.Type = Plugin.Type.Utility
1321
override lateinit var analytics: Analytics

0 commit comments

Comments
 (0)