闪屏页 数据埋点
This commit is contained in:
parent
1123dc2c9e
commit
b3a7a610a5
|
|
@ -1,18 +1,21 @@
|
|||
package com.gamedog.statisticreporter.shushu
|
||||
|
||||
import android.os.Bundle
|
||||
import cn.thinkingdata.analytics.BuildConfig
|
||||
import cn.thinkingdata.analytics.TDAnalytics
|
||||
import cn.thinkingdata.analytics.TDAnalytics.TDAutoTrackEventType
|
||||
import cn.thinkingdata.analytics.TDConfig
|
||||
import cn.thinkingdata.analytics.ThinkingAnalyticsSDK
|
||||
import com.ama.core.architecture.BaseApp
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
|
||||
|
||||
class ShushuManager private constructor() {
|
||||
|
|
@ -49,16 +52,15 @@ class ShushuManager private constructor() {
|
|||
* 记录用户的具体行为事件。
|
||||
* 用户点击按钮、浏览页面、完成购买等。
|
||||
*/
|
||||
fun reportEvent(eventKey: String) {
|
||||
val properties = JSONObject().apply {
|
||||
put("product_id", "12345") // 商品ID
|
||||
put("product_name", "咖啡杯") // 商品名称
|
||||
put("price", 29.9) // 商品价格
|
||||
put("order_id", "ORDER_20250104_001") // 订单ID
|
||||
fun reportEvent(eventKey: String, params: Map<String, Any>?) {
|
||||
val jsonObj = params?.let {
|
||||
JSONObject(params)
|
||||
}
|
||||
TDAnalytics.track(eventKey, properties)
|
||||
TDAnalytics.track(eventKey, jsonObj)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置用户属性(会覆盖同名属性)。
|
||||
* 记录用户会员等级、姓名等相对固定的属性。
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.gamedog.vididin
|
||||
|
||||
import com.gamedog.statisticreporter.firbase.FireBaseManager
|
||||
import com.gamedog.statisticreporter.shushu.ShushuManager
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
object StatisticUtil {
|
||||
|
||||
private val mBgScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
|
||||
const val KEY_Loading_Start: String = "Loading_Start"
|
||||
const val KEY_Loading_End: String = "Loading_End"
|
||||
const val KEY_Home_Show: String = "Home_Show"
|
||||
const val KEY_Guide: String = "Guide"
|
||||
const val KEY_RV_Button_Show: String = "RV_Button_Show"
|
||||
const val KEY_RV_Button_Click_Game: String = "RV_Button_Click_Game"
|
||||
const val KEY_Video_Play_Start: String = "Video_Play_Start"
|
||||
const val KEY_Video_Play_End: String = "Video_Play_End"
|
||||
const val KEY_Welfare_Show: String = "Welfare_Show"
|
||||
const val KEY_Chest_Claim_Click: String = "Chest_Claim_Click"
|
||||
const val KEY_Welfare_Task_Click: String = "Welfare_Task_Click"
|
||||
const val KEY_H5_Button_Click: String = "H5_Button_Click"
|
||||
const val KEY_H5_Show: String = "H5_Show"
|
||||
const val KEY_lottery_Button_Click: String = "lottery_Button_Click"
|
||||
const val KEY_lottery_Show: String = "lottery_Show"
|
||||
const val KEY_Daily_Task_Complete: String = "Daily_Task_Complete"
|
||||
const val KEY_Daily_Sign: String = "Daily_Sign"
|
||||
const val KEY_Withdraw_Click: String = "Withdraw_Click"
|
||||
const val KEY_Withdrawal_Show: String = "Withdrawal_Show"
|
||||
const val KEY_Withdrawal_finsh: String = "Withdrawal_finsh"
|
||||
const val KEY_Withdrawal_Info: String = "Withdrawal_Info"
|
||||
const val KEY_Withdrawal_Apply: String = "Withdrawal_Apply"
|
||||
const val KEY_Withdrawal_Reason: String = "Withdrawal_Reason"
|
||||
const val KEY_Push_Request_Show: String = "Push_Request_Show"
|
||||
const val KEY_xxx: String = "xxx"
|
||||
|
||||
|
||||
/*Video_Like_Click
|
||||
Video_Share_Click*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*Push_Request_Result
|
||||
Push_Show
|
||||
Push_Click
|
||||
Push_EnterGame
|
||||
adjust_init
|
||||
adjust_get_success
|
||||
ad_click
|
||||
ad_close
|
||||
ad_start_load
|
||||
ad_loaded
|
||||
ad_load_fail
|
||||
ad_show_fail
|
||||
ad_position
|
||||
ad_impression
|
||||
*/
|
||||
|
||||
fun reportEvents(eventKey: String, eventData: Map<String, Any>? = null) {
|
||||
mBgScope.launch {
|
||||
FireBaseManager.instance().reportEvent(eventKey, eventData)
|
||||
ShushuManager.instance().reportEvent(eventKey, eventData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -4,10 +4,13 @@ import android.animation.ObjectAnimator
|
|||
import android.animation.ValueAnimator
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.animation.LinearInterpolator
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
|
||||
import com.gamedog.vididin.StatisticUtil
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.router.Router
|
||||
import com.remax.base.report.DataReportManager
|
||||
|
|
@ -31,6 +34,7 @@ import com.viddin.videos.free.databinding.ActivitySplashBinding as ViewBinding
|
|||
@AndroidEntryPoint
|
||||
class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyleListener {
|
||||
|
||||
private var mStartMs: Long = 0L
|
||||
private var isAdLoaded = false
|
||||
private var startTime = 0L
|
||||
|
||||
|
|
@ -42,9 +46,18 @@ class SplashActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyle
|
|||
startTime = System.currentTimeMillis()
|
||||
|
||||
with(binding) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
|
||||
super.onCreate(savedInstanceState, persistentState)
|
||||
mStartMs = System.currentTimeMillis()
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Loading_Start, mapOf("Time" to (System.currentTimeMillis() - mStartMs)/1000))
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Loading_Start, )
|
||||
}
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue