Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzmpr/trckr
Kotlin Symbol Processor to simplify analytics tracking.
https://github.com/dzmpr/trckr
analytics android kotlin ksp
Last synced: 5 days ago
JSON representation
Kotlin Symbol Processor to simplify analytics tracking.
- Host: GitHub
- URL: https://github.com/dzmpr/trckr
- Owner: dzmpr
- License: apache-2.0
- Created: 2022-06-25T18:34:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-26T17:28:10.000Z (6 months ago)
- Last Synced: 2024-08-02T09:27:26.253Z (3 months ago)
- Topics: analytics, android, kotlin, ksp
- Language: Kotlin
- Homepage: https://dzmpr.github.io/trckr/
- Size: 1.12 MB
- Stars: 37
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-multiplatform - trckr - KSP processer that simplifies the collection of analytics (Libraries / Annotation Processor)
- awesome-list - dzmpr/trckr - Kotlin Symbol Processor to simplify analytics tracking. (Kotlin)
- kmp-awesome - trckr - KSP processor (Libraries / 🔍 Analytics)
README
# trckr
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ru.cookedapp.trckr/trckr-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ru.cookedapp.trckr/trckr-core)
[![CI](https://github.com/dzmpr/trckr/actions/workflows/tests.yml/badge.svg)](https://github.com/dzmpr/trckr/actions/workflows/tests.yml)
[![KMM](https://img.shields.io/badge/KMM-supported-orange)](https://kotlinlang.org/docs/multiplatform-mobile-getting-started.html)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)Trckr is **Kotlin Symbol Processor** to help you send analytics to multiple destinations (called adapters).
## Why trckr?
In a large project you can have multiple analytics targets that should receive events from your app. That creates a lot of boilerplate code to implement tracker that uses all analytics targets.
Trckr created to eliminate this problem. You need to create target adapters just once, and trckr generate events from interface methods for you.
To declare tracker you define interface, annotated with `@Tracker` annotation and event methods with `@Event` annotation:
```kotlin
@Tracker
interface ExampleTracker {@Event(name = "Event name")
fun event(
@Param(name = "Parameter name") data: Int,
)
}
```
And create instance of tracker using generated method:
```kotlin
val tracker = createExampleTracker {
addAdapter(FirebaseAdapter())
addAdapter(AmplitudeAdapter())
addAdapter(AdjustAdapter())
}
tracker.event(data = 42)
```
After calling event method trckr sends it to all registered adapters.
```mermaid
flowchart TD;
E[ExampleTracker] --event--> A;
A[Trckr] --event--> B[Firebase] & C[Amplitude] & D[Adjust];
```## Key features
* Adapters skipping
* Parameter converters support
* Multimodule project supportMore you can find at [advanced features](https://dzmpr.github.io/trckr/advanced_features/) page.
## Gradle setup
1. Add KSP plugin to your module's `build.gradle.kts`:
```kotlin
plugins {
id("com.google.devtools.ksp") version "2.0.0-1.0.21"
}
```
2. Add `Maven Central` to the repositories blocks in your project's `build.gradle.kts`:
```kotlin
repositories {
mavenCentral()
}
```
3. Add `trckr` dependencies:
```kotlin
dependencies {
implementation("ru.cookedapp.trckr:trckr-core:1.2.1")
ksp("ru.cookedapp.trckr:trckr-processor:1.2.1")
}
```
4. Add KSP source path:To access generated code from KSP, you need to set up the source path into your module's `build.gradle.kts` file:
```kotlin
kotlin {
// ...
sourceSets.configureEach {
kotlin.srcDir(layout.buildDirectory.dir("/generated/ksp/$name/kotlin/"))
}
}
```## License
```text
Copyright 2022 Dzmitry PryskokaLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```