An unofficial Android SDK for https://plausible.io
Find a file
William Brawner 76f8f68103 Remove domain and screenWidth from Plausible.event()
These values were coming from the config by default anyways, and they're not likely to be changed between events, so it's probably better to just simplify the API a bit
2022-11-06 20:27:08 -07:00
.idea Configure Maven Central publishing 2022-11-01 07:12:43 -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 Remove domain and screenWidth from Plausible.event() 2022-11-06 20:27:08 -07:00
.gitignore Initial commit 2022-10-29 21:49:40 -06:00
build.gradle Configure Maven Central publishing 2022-11-01 07:12:43 -06:00
gradle.properties Configure Maven Central publishing 2022-11-01 07:12:43 -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 Add license to README.md 2022-11-01 07:14:15 -06:00
settings.gradle Configure Maven Central publishing 2022-11-01 07:12:43 -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">false</string>

You can then manually enable the sdk with the following:

Plausible.enable(true)

Sending Events

Page Views

Plausible.pageView("/settings")

Custom Events

Plausible.event("ctaClick")

Download

This project is still in early development, so while I finalize the API, write the documentation, and begin writing tests, I'll only be publishing to Sonatype's snapshots repository:

repositories {
    maven {
        url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
    }
}

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

License

Copyright 2022 William Patrick Brawner

Licensed 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 at

   http://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.