Browse Source

增加H5埋点事件

Pq 2 years ago
parent
commit
24e61e5cbf

+ 2 - 0
BaseLibrary/src/main/java/com/cooleshow/base/common/WebApi.java

@@ -8,5 +8,7 @@ public class WebApi {
     public static final String openCourseDetail = "openCourseDetail";
     //签署协议成功
     public static final String OPEN_PAGE_SUCCESS = "openPageSuccess";
+    //事件埋点
+    public static final String SET_EVENT_TRACKING = "setEventTracking";
     public static final String WITHDRAW_TAG = "WITHDRAW";
 }

+ 12 - 0
student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceAccomPanyUtils.java

@@ -9,8 +9,10 @@ import android.view.WindowManager;
 import android.webkit.JavascriptInterface;
 
 import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebApi;
 import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.student.helper.EventHelper;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.gyf.immersionbar.ImmersionBar;
@@ -313,6 +315,16 @@ public class JsInterfaceAccomPanyUtils extends Object {
                         onListener.savePicture(content.getString("base64"),content.getString("uuid"));
                     }
                 }
+
+                if (TextUtils.equals(WebApi.SET_EVENT_TRACKING, api)) {
+                    //事件埋点
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    String eventId = content.optString("type");
+                    if (!TextUtils.isEmpty(eventId)) {
+                        EventHelper.addEvent(eventId);
+                    }
+                    return;
+                }
             } catch (Exception e) {
 
             }

+ 11 - 1
student/src/main/java/com/cooleshow/student/widgets/helper/JsInterfaceUtils.java

@@ -11,7 +11,9 @@ import android.view.WindowManager;
 import android.webkit.JavascriptInterface;
 
 import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebApi;
 import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.student.helper.EventHelper;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.gyf.immersionbar.ImmersionBar;
@@ -241,7 +243,15 @@ public class JsInterfaceUtils extends Object {
                     }
                 }
 
-
+                if (TextUtils.equals(WebApi.SET_EVENT_TRACKING, api)) {
+                    //事件埋点
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    String eventId = content.optString("type");
+                    if (!TextUtils.isEmpty(eventId)) {
+                        EventHelper.addEvent(eventId);
+                    }
+                    return;
+                }
             } catch (Exception e) {
             }
         });

+ 12 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/helper/JsInterfaceAccomPanyUtils.java

@@ -9,8 +9,10 @@ import android.view.WindowManager;
 import android.webkit.JavascriptInterface;
 
 import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebApi;
 import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.teacher.helper.EventHelper;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.gyf.immersionbar.ImmersionBar;
@@ -310,6 +312,16 @@ public class JsInterfaceAccomPanyUtils extends Object {
                         onListener.savePicture(content.getString("base64"),content.getString("uuid"));
                     }
                 }
+
+                if (TextUtils.equals(WebApi.SET_EVENT_TRACKING, api)) {
+                    //事件埋点
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    String eventId = content.optString("type");
+                    if (!TextUtils.isEmpty(eventId)) {
+                        EventHelper.addEvent(eventId);
+                    }
+                    return;
+                }
             } catch (Exception e) {
 
             }

+ 11 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/helper/JsInterfaceUtils.java

@@ -14,6 +14,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.common.WebApi;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.utils.LogUtils;
+import com.cooleshow.teacher.helper.EventHelper;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.gyf.immersionbar.ImmersionBar;
@@ -289,6 +290,16 @@ public class JsInterfaceUtils extends Object {
                     }
                     return;
                 }
+
+                if (TextUtils.equals(WebApi.SET_EVENT_TRACKING, api)) {
+                    //事件埋点
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    String eventId = content.optString("type");
+                    if (!TextUtils.isEmpty(eventId)) {
+                        EventHelper.addEvent(eventId);
+                    }
+                    return;
+                }
             } catch (Exception e) {
             }
         });