BloodHound

Additional

Language
Kotlin
Version
1.0.5 (May 7, 2016)
Created
May 7, 2016
Updated
Aug 13, 2019
Owner
Jan Rabe (kibotu)
Contributor
Jan Rabe (kibotu)
1
Activity
Badge
Generate
Download
Source code

Advertisement

BloodHoud

Tiny library for tracking screens and events with google analytics and / or firebase analytics.

How to install

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"
}

How to use

Google Analytics

  1. Add gms version to manifest

     <application>
         <meta-data
             android:name="com.google.android.gms.version"
             android:value="@integer/google_play_services_version" />
     </application>
    
  2. Initialize

     BloodHound.with(context, "trackingId")
    
  3. Track Screens

     BloodHound.screen("main_screen")
    
  4. Track Events

    BloodHound.track("category", "action", "app_start",
         mapOf("user" to UUID.randomUUID().toString()) // (optional) parameters
    )
    
  5. (optional) Reset client

     BloodHound.reset()
    

Firebase

  1. Initialize

     BloodHound.with(context)
    
  2. Track Screens

     BloodHound.screen("main_screen")
    
     // with screen class
     // BloodHound.screen("main_screen", MainActivity::class.java.simpleName)
    
  3. Track Events

     BloodHound.track("main_screen", "user_event",
         mapOf("user" to UUID.randomUUID().toString()) // (optional) parameters
     )
    
  4. (optional) Reset client

     BloodHound.reset()
    

GoogleAnalyitcsOptions (defaults)

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
))

FirebaseOptions (defaults)

BloodHound.with(this, FirebaseOptions(
    enableDebugging = false,
    enableLogging = false
))

License

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.