Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vinceglb/logsnag-kotlin
Kotlin LogSnag client to easily track events in your Kotlin Multiplatform projects
https://github.com/vinceglb/logsnag-kotlin
analytics android ios jvm kotlin kotlin-multiplatform logsnag tracking
Last synced: 1 day ago
JSON representation
Kotlin LogSnag client to easily track events in your Kotlin Multiplatform projects
- Host: GitHub
- URL: https://github.com/vinceglb/logsnag-kotlin
- Owner: vinceglb
- License: mit
- Created: 2024-01-16T00:00:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-06T12:05:31.000Z (about 2 months ago)
- Last Synced: 2024-12-06T13:38:26.758Z (about 2 months ago)
- Topics: analytics, android, ios, jvm, kotlin, kotlin-multiplatform, logsnag, tracking
- Language: Kotlin
- Homepage: https://logsnag.com
- Size: 246 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 📦 Setup
1. Add the following to your `build.gradle.kts` file:
```kotlin
repositories {
mavenCentral()
}dependencies {
implementation("io.github.vinceglb:logsnag-kotlin:1.1.1")
}
```2. Choose and add to your dependencies one of [Ktor's engines](https://ktor.io/docs/http-client-engines.html). In case of Kotlin Multiplatform project, add an engine to each target.
## 🧑💻 Usage
### ⚡️ Initialize Client
Create an instance of `LogSnag` client:
```kotlin
val logSnag = LogSnag(
token = "your-token",
project = "your-project",
)
```### 📝 Track Event
Send a track event to LogSnag:
```kotlin
logSnag.track(
channel = "waitlist",
event = "User Joined",
description = "A user joined the waitlist",
icon = "🎉",
userId = "user_123",
tags = mapOf("source" to "google"),
notify = true,
)
```### 👤 User Properties
Identify a user and set their properties:
```kotlin
logSnag.identify(
userId = "user_123",
properties = mapOf(
"name" to "John Doe",
"email" to "[email protected]",
"plan" to "premium",
),
)
```### ✨ Track Insight
Send a insight track to LogSnag:
```kotlin
logSnag.insightTrack(
title = "User Count",
value = "100",
icon = "👨",
)
```### ➕ Increment Insight
Increment an insight track to LogSnag:
```kotlin
logSnag.insightIncrement(
title = "User Count",
value = 1,
icon = "👨",
)
```## 🤩 Contributing
To be able to work on the project locally, you need to update the `local.properties` file with your LogSnag token and project ID:
```properties
LOGSNAG_TOKEN=your-token
LOGSNAG_PROJECT=your-project
```