An android library that centralizes analytics services in one place can be a useful tool for developers who want to track the usage and performance of their app. Should be easy as it sounds, a single implementation to start with the base analytics core features, and then you can add each analytic service separately (to preserve library size). A debug analytics mode that can log the same properties in the debug console.
In your app level build.gradle
file, add:
dependencies {
implementation 'io.github.aminekarimii:analytiks:VERSION'
implementation 'io.github.aminekarimii:analytiks-core:VERSION'
// You can add each Addon separately as following:
implementation 'io.github.aminekarimii:analytiks-addon-googleanalytics:VERSION'
implementation 'io.github.aminekarimii:analytiks-addon-mixpanel:VERSION'
implementation 'io.github.aminekarimii:analytiks-addon-timber:VERSION'
implementation 'io.github.aminekarimii:analytiks-addon-segment:VERSION'
}
- In your activity, initiate the Analytiks library and keep an object to be used after as following:
private lateinit var analytiks: Analytiks
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ...
analytiks = Analytiks.Builder()
.addClient(CustomAnalytiksAddon())
.addClient(MixpanelAnalyticsClient(token = "YOUR_TOKEN"))
.addClient(
SegmentAnalyticsClient(
token = "YOUR_TOKEN",
flushIntervalInSeconds = 5,
trackApplicationLifecycleEvents = true,
)
)
}
- Initialize the addons
analytiks.initialize(this.applicationContext)
- You're good to go!
analytiks.logEvent("your_event_name")
analytiks.pushAll()
The list of features provided by the library
- Initialization:
init
Initialize the "analytiks" library, along with its sub-libraries, during the initialization process. - Log event:
event
send/save an event with a name and an optional set of properties. - Identify user:
identify
Identify the current user by the given ID or a random UUID in case of an empty one. - Set user property:
setUserProperty
Sets a key value property to the identified user. - Reset:
reset
the plugins and remove the default user's configuration. - Flush events
flush
sends the recorded local data to the service servers on call.
Events App Log Shortcut (expand)
See what's happening in your app in real-time with Analytiks AppVisor. It's essentially your go-to for tracking events, serving as a local logger to make sure everything's logged just right, from the initialization to the events push with the exact date & time.- Event Visualization: Easily view all recorded events within your application in a simple and intuitive UI.
- Event Sharing: Share specific events as text directly from the app visor, facilitating seamless collaboration among team members.
- New Event Notifications: Receive notifications for new events to stay updated on your app's activity without constant manual checks.
To integrate this feature into your application, follow the steps below:
- Add Dependency: Ensure your
build.gradle
file includes theanalytiks-addon-appvisor
module as a dependency:
dependencies {
implementation 'io.github.aminekarimii:analytiks-addon-appvisor:{LATEST_VERSION}'
}
- Initialization: Initialize AnalytiksVisor and add the interceptor to your Analytiks configuration:
Analytiks.Builder()
.addInterceptor(AppVisorActivity.initialize())
// ...
.build()
- Create Shortcut: to create AnalytiksVisor Shortcut, add:
class AnalytiksApplication : Application() {
override fun onCreate() {
super.onCreate()
AnalytiksVisor.createShortcut(this)
}
}
Screen_recording_20240305_234527.webm
Here's a list of the most known analytics services that we will support in our library.
Service | Status | Implementation | Official documentation |
---|---|---|---|
Google/Firebase Analytics | β | Firebase/Google Addon doc | Firebase Analytics doc |
Segment | β | Segment Addon doc | Segment doc |
Mixpanel | β | Mixpanel Addon doc | Mixpanel doc |
Flurry Analytics | π§ | - | - |
Amplitude | β | Amplitude Addon doc | Amplitude doc |
App Annie | π§ | - | - |
Localytics | π§ | - | - |
AppsFlyer | π§ | - | - |
App Center Analytics | π§ | - | - |
Onesignal | π§ | - | - |
Timber - For local event logging | β | - | github/JakeWharton/timber |
Your Custom Addon | β | - | Instructions |
β Can't find your service? open an issue with the name and the direct documentation link in the comment section.
For any questions, suggestions, or discussions regarding the "Analytiks" library, feel free to reach out through the following channels:
- Email: aminekarimi1998@gmail.com
- LinkedIn: aminekarimi
- Twitter: @aminekarimii
- GitHub: aminekarimii
Apache 2.0 License
Copyright 2022 KARIMI Amine
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.