An unofficial Android SDK for https://plausible.io
Find a file
2022-11-01 05:58:12 -06:00
.idea Initial commit 2022-10-29 21:49:40 -06:00
app Initial commit 2022-10-29 21:49:40 -06:00
gradle/wrapper Initial commit 2022-10-29 21:49:40 -06:00
plausible Initial commit 2022-10-29 21:49:40 -06:00
.gitignore Initial commit 2022-10-29 21:49:40 -06:00
build.gradle Initial commit 2022-10-29 21:49:40 -06:00
gradle.properties Initial commit 2022-10-29 21:49:40 -06:00
gradlew Initial commit 2022-10-29 21:49:40 -06:00
gradlew.bat Initial commit 2022-10-29 21:49:40 -06:00
LICENSE Add license 2022-11-01 05:58:12 -06:00
README.md Initial commit 2022-10-29 21:49:40 -06:00
settings.gradle Initial commit 2022-10-29 21:49:40 -06:00

Plausible Android

This is an unofficial Android SDK to record events with a Plausible backend.

Usage

Configuration

For simple use cases, you can just declare the domain for which you'd like to send events in your strings.xml file:

<string name="plausible_domain">example.com</string>

If you're self-hosting Plausible, you'll need to provide the URL for your instance as well:

<string name="plausible_host">https://plausible.my-company.com</string>

By default, the SDK will be enabled at app startup, though you can prevent this to allow users to opt-in or opt-out like so:

<string name="plausible_enable_startup">true</string>

You can then manually enable the sdk with the following:

Plausible.enable(true)

If you'd like to set a static user agent, you can do that as well:

<string name="plausible_user_agent" />

Though it's probably best to use a unique user-agent for

Sending Events

Page Views

Plausible.pageView("/settings")

Custom Events

Plausible.event("ctaClick")

Download

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.wbrawner.plausble:plausible-android:0.1.0-SNAPSHOT'
}