光环助手V3.2数据统计需求(MTA)(完成)

This commit is contained in:
kehaoyuan
2018-04-12 18:37:00 +08:00
parent 347a83cf0f
commit 2102dd729c
12 changed files with 97 additions and 19 deletions

View File

@ -3,6 +3,7 @@ package com.gh.common.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import com.gh.common.constant.Config;
import com.lightgame.config.CommonDebug;
@ -100,9 +101,29 @@ public class DataUtils {
}
// MTA ->【次数统计】Key-Value参数的事件
public static void onMtaEvent(Context context, String eventId, String... kv) {
if (CommonDebug.IS_DEBUG && (kv == null || kv.length % 2 != 0)) {
throw new IllegalStateException("onEvent kv 必须不为空且数量为偶数");
}
Properties prop = new Properties();
for (int i = 0; i < kv.length; i++) {
if (i % 2 != 0 || i != 0) {
String key = kv[i - 1];
String value = kv[i];
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
prop.setProperty(key, value);
}
}
}
StatService.trackCustomKVEvent(context, eventId, prop);
}
public static void onEvent(Context var0, String var1, String var2) {
TCAgent.onEvent(var0, var1, var2);
StatService.trackCustomEvent(var0, var1, var2);
Properties prop = new Properties();
prop.setProperty(var1, var2);
StatService.trackCustomKVEvent(var0, var1, prop);
}
public static void onPause(Activity var0) {