Tiny library for tracking screens and events with google analytics and / or firebase analytics.
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implement 'com.github.kibotu:BloodHound:-SNAPSHOT'
// for google analytics
implement "com.google.android.gms:play-services-gcm:16.0.0"
implement "com.google.android.gms:play-services-analytics:16.0.6"
// for firebase
implement "com.google.firebase:firebase-core:16.0.6"
}
-
Add gms version to manifest
<application> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application>
-
Initialize
BloodHound.with(context, "trackingId")
-
Track Screens
BloodHound.screen("main_screen")
-
Track Events
BloodHound.track("category", "action", "app_start", mapOf("user" to UUID.randomUUID().toString()) // (optional) parameters )
-
(optional) Reset client
BloodHound.reset()
-
Initialize
BloodHound.with(context)
-
Track Screens
BloodHound.screen("main_screen") // with screen class // BloodHound.screen("main_screen", MainActivity::class.java.simpleName)
-
Track Events
BloodHound.track("main_screen", "user_event", mapOf("user" to UUID.randomUUID().toString()) // (optional) parameters )
-
(optional) Reset client
BloodHound.reset()
BloodHound.with(this, "trackingId", GoogleAnalyitcsOptions(
enableDebugging = false,
enableLogging = false,
exceptionReporting = false,
advertisingIdCollection = true,
autoActivityTracking = false,
sessionTimeout = 300,
sampleRate = 100.0,
sessionLimit = 500,
dryRun = false,
anonymizeIp = true
))
BloodHound.with(this, FirebaseOptions(
enableDebugging = false,
enableLogging = false
))
Copyright 2019 Jan Rabe 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.