Tracker
English | 中文
Tracker is a lightweight tracking framework based on the tracking idea of Buzzvideo.
Tracking idea
Why use chain of responsibility tracking?
Gradle
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
// ...
maven { url 'https://www.jitpack.io' }
}
}
Add dependencies:
dependencies {
implementation 'com.github.DylanCaiCoding:Tracker:1.0.1'
}
Usage
Sample
Set a trackNode
for the Activity/Fragment/View to add tracking parameters.
trackNode = TrackNode("channel_name" to "recommend")
holder.itemView.trackNode = TrackNode("video_id" to item.id, "video_type" to item.type)
Set a referrer node and a page node to establish a chain of source responsibilities between activity.
val intent = Intent(activity, DetailsActivity::class.java).putReferrerTrackNode(view)
activity.startActivity(intent)
activity.trackNode = PageTrackNode("page_name" to "details")
This creates a chain of responsibility similar to the one below.
Then it can collect and post the parameters on the responsibility chain through any view.
view.postTrack("click_favorite")
This library has Kotlin and Java sample code for simulating Buzzvideo tracking requirements.
Change log
Author's other libraries
Library | Description |
---|---|
Longan | Probably the best Kotlin utils library for Android. |
LoadingStateView | Decoupling the code of toolbar or loading status view. |
ViewBindingKTX | The most comprehensive utils of ViewBinding. |
MMKV-KTX | Use MMKV with property delegates. |
License
Copyright (C) 2022. Dylan Cai
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.