← All projects
UmamiLib icon

UmamiLib

Kotlin Multiplatform · Android, iOS

A Kotlin Multiplatform library that sends Umami analytics from a mobile app, the same self-hosted Umami that counts visits to this blog. It talks to Umami’s API directly, so there’s no WebView and no third-party tracker in the app. sBrowser, Gas On Route, Weekly Weather and Public Pool all use it.

Features

  • Page views, custom events and user identification from shared Kotlin code
  • One UmamiConfig (website id, server URL, hostname, app name) and a factory per platform
  • A pluggable device id repository, so you decide how a device is identified
  • DI-agnostic, with examples for Koin and Hilt

Usage

Published to my Gogs-hosted Maven repository:

implementation("com.codeskraps.umamilib:umamilib:0.4.1")
val analytics = Umami.create(
    application = application,
    config = UmamiConfig(
        websiteId = "your-website-id",
        baseUrl = "https://your-umami-instance.com",
        hostname = "your.app",
        appName = "YourApp"
    )
)

Posts