This commit is contained in:
juntao
2021-02-02 16:49:48 +08:00
parent 3b8d34f8c3
commit a4a029f31e
3 changed files with 37 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import com.gh.gamecenter.entity.CommunityEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.ShareResultEntity;
import com.gh.gamecenter.entity.SpecialColumn;
import com.gh.gamecenter.entity.StartupAdEntity;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.EmptyResponse;
@ -786,4 +787,29 @@ public class LogUtils {
}
LoghubUtils.log(object, "event", false);
}
public static void logStartAd(String event, StartupAdEntity adEntity) {
JSONObject object = new JSONObject();
try {
object.put("event", event);
object.put("timestamp", System.currentTimeMillis() / 1000);
object.put("meta", getMetaObject());
if (adEntity != null) {
object.put("abs_id", adEntity.getId());
object.put("abs_text", adEntity.getDesc());
if (adEntity.getButton()) {
object.put("abs_type", adEntity.getJump().getType());
object.put("abs_link", adEntity.getJump().getLink());
object.put("abs_link_title", adEntity.getJump().getText());
}
}
} catch (JSONException e) {
e.printStackTrace();
}
if (BuildConfig.DEBUG) {
Utils.log("LogUtils->" + object.toString());
}
LoghubUtils.log(object, "event", false);
}
}

View File

@ -359,8 +359,14 @@ public class MainActivity extends BaseActivity {
adContentTv.setVisibility(View.VISIBLE);
if (ad.getButton()) {
View btn = findViewById(R.id.adBtn);
btn.setOnClickListener((v) -> DirectUtils.directToLinkPage(this, ad.getJump(), "(启动广告)", ""));
btn.setOnClickListener((v) -> {
DirectUtils.directToLinkPage(this, ad.getJump(), "(启动广告)", "");
LogUtils.logStartAd("click_watch_start_ads", ad);
});
btn.setVisibility(View.VISIBLE);
LogUtils.logStartAd("watch_start_ads", ad);
} else {
LogUtils.logStartAd("start_ads", ad);
}
}

View File

@ -1,6 +1,10 @@
package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
data class StartupAdEntity(
@SerializedName("_id")
val id: String,
val desc: String,
val button: Boolean,
val jump: LinkEntity)