-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from aminekarimii/dev
v1.1.0 - Merge dev into master
- Loading branch information
Showing
68 changed files
with
1,744 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.iml | ||
*.gpg | ||
.gradle | ||
/local.properties | ||
/.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,137 @@ | ||
# <p align="center"> 📊Analytiks</p> | ||
<p align="center"> | ||
<a href="https://github.com/skydoves/PowerSpinner/actions"><img alt="Build Status" src="https://github.com/aminekarimii/analytiks/workflows/Android%20CI/badge.svg"/></a> | ||
<a href="https://jitpack.io/#aminekarimii/Analytiks"><img alt="JitPack version" src="https://jitpack.io/v/aminekarimii/Analytiks.svg"/></a> | ||
<a href="https://github.com/aminekarimii/analytiks/actions"><img alt="Build Status" src="https://github.com/aminekarimii/analytiks/workflows/Android%20CI/badge.svg"/></a> | ||
</p> | ||
|
||
![Analytiks cover illustration](https://user-images.githubusercontent.com/20410115/228402805-3309d17a-0bc5-4404-90f8-20c9b30e33a9.png) | ||
![Group 54 (1)](https://user-images.githubusercontent.com/20410115/228402805-3309d17a-0bc5-4404-90f8-20c9b30e33a9.png) | ||
|
||
## ✏️ Description | ||
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 analytics service separately (to preserve library size). | ||
## 💭 Overview | ||
|
||
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. | ||
|
||
![Scheme of the library logic](https://user-images.githubusercontent.com/20410115/225161402-d3a7d24f-da0d-4360-abab-fe86c68f0214.png) | ||
|
||
## 📥 Download | ||
Add it in your root ```build.gradle``` at the end of repositories: | ||
```gradle | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
and in your app level ```build.gradle``` file, add: | ||
[![Release](https://img.shields.io/maven-central/v/io.github.aminekarimii/analytiks)](https://img.shields.io/maven-central/v/io.github.aminekarimii/analytiks) | ||
|
||
In your app level ```build.gradle``` file, add: | ||
|
||
```gradle | ||
dependencies { | ||
implementation 'com.github.aminekarimii.analytiks:analytiks:{LATEST-VERSION}' | ||
// You can add each addon separately as following: | ||
implementation 'com.github.aminekarimii.analytiks:analytiks-googleanalytics:{LATEST-VERSION}' // Optional Firebase Analytics addon | ||
implementation 'com.github.aminekarimii.analytiks:analytiks-segment:{LATEST-VERSION}' // Optional Segment addon | ||
// Add any other optional addons here using this pattern: | ||
// com.github.aminekarimii.analytiks:analytiks-<ADDON-NAME>:<LATEST-VERSION> | ||
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' | ||
} | ||
``` | ||
|
||
## 🔌 Setup | ||
1- In your activity, initiate the Analytiks library and keep an object to be used after as following: | ||
|
||
1. In your activity, initiate the Analytiks library and keep an object to be used after as | ||
following: | ||
|
||
```kotlin | ||
private lateinit var analytiks: Analytiks | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// ... | ||
val clients = listOf( | ||
TimberLocalClient(), | ||
MixpanelAnalyticsClient(token = "YOUR_TOKEN") | ||
// Your addons | ||
) | ||
|
||
analytiks = Analytiks(clients) | ||
analytiks = Analytiks.Builder() | ||
.addClient(CustomAnalytiksAddon()) | ||
.addClient(MixpanelAnalyticsClient(token = "YOUR_TOKEN")) | ||
.addClient( | ||
SegmentAnalyticsClient( | ||
token = "YOUR_TOKEN", | ||
flushIntervalInSeconds = 5, | ||
trackApplicationLifecycleEvents = true, | ||
) | ||
) | ||
} | ||
``` | ||
2- Initialize the addons | ||
|
||
2. Initialize the addons | ||
|
||
```kotlin | ||
analytiks.initialize(this.applicationContext) | ||
``` | ||
|
||
3- You're good to go! | ||
3. You're good to go! | ||
|
||
```kotlin | ||
analytiks.logEvent("your_event_name") | ||
// ... | ||
analytiks.pushAll() | ||
``` | ||
|
||
## 🪄 Features | ||
The list of features provided by the library | ||
- **Initialization:** `init` Initialize the "analytiks" library, along with its sub-libraries, during the initialization process. | ||
## 🧪 Features | ||
|
||
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. | ||
- **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 users configuration. | ||
- **Flush events** `pushAll` send the recorded local data to the service servers on call. | ||
- **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. | ||
|
||
## 🔍 AnalytiksVisor | ||
<details> | ||
<summary><strong> Events App Log Shortcut</strong> (expand) </summary> | ||
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. | ||
|
||
### Key Features | ||
|
||
- **Event Visualization**: Easily view all recorded events within your application in a simple and intuitive UI. | ||
#### 🚧 Coming up | ||
- **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. | ||
|
||
### Getting Started | ||
|
||
To integrate this feature into your application, follow the steps below: | ||
|
||
1. **Add Dependency**: Ensure your `build.gradle` file includes the `analytiks-addon-appvisor` module as a dependency: | ||
|
||
```groovy | ||
dependencies { | ||
implementation 'io.github.aminekarimii:analytiks-addon-appvisor:{LATEST_VERSION}' | ||
} | ||
``` | ||
|
||
2. **Initialization**: Initialize AnalytiksVisor and add the interceptor to your Analytiks configuration: | ||
|
||
```kotlin | ||
Analytiks.Builder() | ||
.addInterceptor(AppVisorActivity.initialize()) | ||
// ... | ||
.build() | ||
``` | ||
|
||
3. **Create Shortcut**: to create AnalytiksVisor Shortcut, add: | ||
|
||
```kotlin | ||
class AnalytiksApplication : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
AnalytiksVisor.createShortcut(this) | ||
} | ||
} | ||
``` | ||
|
||
### Video Demo | ||
[Screen_recording_20240305_234527.webm](https://github.com/aminekarimii/analytiks/assets/20410115/944a0f7e-da56-4f64-907a-8df0d803e3b7) | ||
|
||
</details> | ||
|
||
|
||
## 🗃 Supported analytics SDKs | ||
Here's a list of the most known analytics services that we will support in our library. | ||
|
@@ -82,7 +141,7 @@ Here's a list of the most known analytics services that we will support in our l | |
| Segment | ✅ | <a href="./addon/analytiks-segment/README.md">Segment Addon doc</a> | <a href="https://segment.com/docs/connections/sources/catalog/libraries/mobile/kotlin-android/" >Segment doc</a> | | ||
| Mixpanel | ✅ | <a href="./addon/analytiks-mixpanel/README.md">Mixpanel Addon doc</a>| <a href="https://developer.mixpanel.com/docs/android">Mixpanel doc</a> | | ||
| Flurry Analytics | 🚧 | - | - | | ||
| Amplitude | 🚧 | - | - | | ||
| Amplitude | ✅ | <a href="./addon/analytiks-amplitude/README.md">Amplitude Addon doc</a> | <a href="https://www.docs.developers.amplitude.com/data/sdks/sdk-quickstart/">Amplitude doc</a> | | ||
| App Annie | 🚧 | - | - | | ||
| Localytics | 🚧 | - | - | | ||
| AppsFlyer | 🚧 | - | - | | ||
|
@@ -93,6 +152,15 @@ Here's a list of the most known analytics services that we will support in our l | |
|
||
➕ Can't find your service? [open an issue](https://github.com/aminekarimii/analytiks/issues/new) with the name and the direct documentation link in the comment section. | ||
|
||
## 📫 Contact Information | ||
|
||
For any questions, suggestions, or discussions regarding the "Analytiks" library, feel free to reach out through the following channels: | ||
|
||
- **Email:** [[email protected]](mailto:[email protected]) | ||
- **LinkedIn:** [aminekarimi](https://www.linkedin.com/in/aminekarimi) | ||
- **Twitter:** [@aminekarimii](https://twitter.com/aminekarimii) | ||
- **GitHub:** [aminekarimii](https://github.com/aminekarimii) | ||
|
||
## License 🔖 | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
<h1 align="center">Amplitude Add-on implementation</h1></br> | ||
<p align="center"> | ||
<img src="https://github.com/aminekarimii/analytiks/assets/20410115/1f330afd-c805-4d54-9b74-654192f019b3" width="25%" /> | ||
</p> | ||
|
||
## Configuration | ||
| Field Name | Description | Default Value | | ||
|----------------------------|------------------------------------------------|---------------| | ||
| token | The token used for tracking events. | - | | ||
| serverGeoZone | The server geo zone for Amplitude server. | ServerGeoZone.EU | | ||
| optOut | Indicates whether opt-out is enabled. | false | | ||
| minTimeBetweenSessionsMillis | Minimum time between sessions in milliseconds. | 10000 | | ||
|
||
Note: The default values mentioned above can be overridden by providing custom values during initialization. | ||
## Create Add-on | ||
1. Download Amplitude analytics add-on: | ||
```gradle | ||
implementation 'io.github.aminekarimii:analytiks-amplitude:1.0.0' | ||
``` | ||
2. Create your own client: | ||
``` kotlin | ||
class AmplitudeClient( | ||
token: "TOUR_TOKEN", | ||
serverGeoZone = ServerGeoZone.EU, | ||
optOut = false, | ||
minTimeBetweenSessionsMillis = 10000 | ||
) | ||
``` | ||
|
||
### Check the official documentation for more details: | ||
➡️ [Official amplitude analytics](https://www.docs.developers.amplitude.com/data/sdks/sdk-quickstart/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
ext { | ||
PUBLISH_ARTIFACT_ID = 'analytiks-addon-appvisor' | ||
} | ||
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" | ||
|
||
android { | ||
namespace 'com.analytiks.addon.appvisor' | ||
compileSdk rootProject.compileSdk | ||
|
||
defaultConfig { | ||
minSdk 21 | ||
targetSdk rootProject.targetSdk | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
buildFeatures { | ||
viewBinding true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion '1.5.1' | ||
} | ||
packagingOptions { | ||
resources { | ||
excludes += '/META-INF/{AL2.0,LGPL2.1}' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.12.0' | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.7.0' | ||
implementation 'androidx.recyclerview:recyclerview:1.3.2' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
|
||
implementation project(':analytiks-core') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> | ||
|
||
<uses-permission | ||
android:name="android.permission.WAKE_LOCK" | ||
android:maxSdkVersion="25" /> | ||
|
||
<queries> | ||
<intent> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<data android:scheme="https" /> | ||
</intent> | ||
<intent> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<data | ||
android:scheme="https" | ||
android:host="www.github.com" /> | ||
</intent> | ||
</queries> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:theme="@style/Theme.AnalyticsApp"> | ||
<activity | ||
android:name="com.analytiks.addon.appvisor.ui.AppVisorActivity" | ||
android:label="@string/app_name" | ||
android:launchMode="singleTask" | ||
android:exported="true" | ||
android:taskAffinity="com.analytiks.addon.appvisor.task" | ||
android:theme="@style/Theme.AnalyticsApp"/> | ||
|
||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.