Sfoglia il codice sorgente

statistic sdk login

billyyoyo 6 anni fa
parent
commit
9ba6da2f46

+ 20 - 0
app/src/main/java/com/sheep/gamegroup/statistics/AppStatistics.java

@@ -65,4 +65,24 @@ public class AppStatistics {
         }
     }
 
+    synchronized public void sendEvent(int type, int subType, String subString) {
+//        if (BuildConfig.DEBUG) return;
+        ApiService apiService = SheepApp.getInstance().getNetComponent().getApiService();
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("type", type);
+        jsonObject.put("subtype", subType);
+        jsonObject.put("substring", subString);
+        apiService.appEventTracking(jsonObject).subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                    }
+                });
+    }
+
 }

+ 1 - 0
app/src/main/java/com/sheep/gamegroup/util/CertificationUtil.java

@@ -85,6 +85,7 @@ public class CertificationUtil {
                 intent.putExtra(activity.getString(R.string.kfzs_duanduan_datashare_certification_token), token);
             }
             activity.startActivity(intent);
+            UMConfigUtils.onSDKEvent(UMConfigUtils.Event.GAME_SDK_AUTHORIZATION_SUCCESS);
             showCertificationErrorAndExitApp(activity, "", 100);
         } catch (Exception e) {
             e.printStackTrace();

+ 14 - 0
app/src/main/java/com/sheep/gamegroup/util/UMConfigUtils.java

@@ -38,6 +38,10 @@ public class UMConfigUtils {
         return activity instanceof ActPay || activity instanceof GameCertificationActivity;
     }
 
+    public enum PageEvent {
+
+    }
+
     //统计点击次数需要的子subtype
     public enum Event {
         GAME_DOWNLOAD("游戏下载次数"),// 5001
@@ -196,6 +200,8 @@ public class UMConfigUtils {
         HTXD_AD("发现 -> 资讯 -> 点击第5项的鸿途信达广告", "需要传 title ,如:{\"title\": \"我是一个标题\" }"),
         GAME_BANNER_CLICK_HORIZONTAL("游戏轮播图", "游戏轮播图点击次数"),
         GAME_WELFARE_SPECIAL_AREA("游戏福利专区", "尝试打开游戏福利专区的次数"),
+        GAME_SDK_AUTHORIZATION_ENTER("游戏登录 -> SDK授权界面"),
+        GAME_SDK_AUTHORIZATION_SUCCESS("游戏登录 -> SDK授权成功"),
         ;
         private String tag;
         private String info;
@@ -340,6 +346,14 @@ public class UMConfigUtils {
         }
     }
 
+    public static void onSDKEvent(Event event) {
+        try {
+            AppStatistics.getInstance().sendEvent(AppStatisticsConfig.SuperType.ONCLICK_EVENT, event.getId(), event.getTag());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     /**
      * Umeng事件统计
      *

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/GameCertificationActivity.java

@@ -26,6 +26,7 @@ import com.sheep.gamegroup.util.Constant;
 import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -107,6 +108,7 @@ public class GameCertificationActivity extends BaseActivity {
     }
 
     public void initData() {
+        UMConfigUtils.onSDKEvent(UMConfigUtils.Event.GAME_SDK_AUTHORIZATION_ENTER);
         if (getIntent().getExtras() == null) {
             CertificationUtil.newInstance().showCertificationErrorAndExitApp(this, "", 2000);
             return;