Skip to content

BabbanGonaDev/BGHyperLogger

Repository files navigation

BGHyperLogger

GitHub release (latest by date including pre-releases) GitHub contributors GitHub last commit GitHub top language

An Android application analytics reporting module built for use in Babbangona Farmer Services mobile applications.

Application analytics tracking is done using two distinct methods/logics.

  • Local logging and uploading of analytics records to a web server.
  • Logging and tracking of user interactions using Mixpanel

Download:


Step 1: Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2: Add the dependency

dependencies {
    implementation 'com.github.BabbanGonaDev:BGHyperLogger:<insert latest version>'
}

How to use:


To use the BGHyperlogger mobile app analytics library, firstly initialize the library in your application's homepage by calling:

LogRecords logger = new LogRecords(this, "T-10000000000000AA");
//where T-10000000000000AA is your user's Staff ID

Then also initialize Mixpanel by calling:

logger.startMixPanelClass(this);

General app logs can be tracked using

logger.captureGeneralLogs()

While specific Audit logs can be tracked using

logger.captureAuditLogs()

User interaction behaviour can also be tracked in two ways.

  1. Using general messages:
logger.mixPanelTracker("User opened camera", this);
  1. Using JSONObjects to capture additional information:
JSONObject obj = new JSONObject();
try {
    obj.put("loginId", "fnsdnfjasdq");
    obj.put("paymentId", "iufsdfdfqew");
    obj.put("profileType", "Premium");
    obj.put("artistName", "Adele");
    obj.put("songId", "12234");
} catch (JSONException e) {
    e.printStackTrace();
}
logger.mixPanelTracker("User purchased a new song", obj, this);

Always remember to trigger sync by calling:

logger.triggerSync(this, 1);

Example


For more understanding and examples, a sample implementation can be found here

Maintenance


This library project is built and maintained by:

© Babbangona Enterprise Systems Engineering 2021. All Rights Reserved