Skip to content

Commit 2bf8c42

Browse files
author
lucas
committed
添加统计视联网小程序的时间的track
1 parent 80a90e4 commit 2bf8c42

File tree

5 files changed

+40
-7
lines changed

5 files changed

+40
-7
lines changed

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/statistics/VenvyStatisticsManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public final class VenvyStatisticsManager {
2121
public static final int VISUAL_SWITCH_COUNT = 3;
2222
public static final int PLAY_CONFIRM = 4;
2323
public static final int PRELOAD_FLOW = 5;
24+
public static final int OPEN_PAGE = 6;
25+
public static final int CLOSE_PAGE = 7;
2426

2527
private Platform platform;
2628
private VenvyStatisticsManager() {
@@ -53,6 +55,8 @@ public void submitCommonTrack(int type, JSONObject jsonObj) {
5355
submitPlayConfirmStatisticsInfo(jsonObj);
5456
}else if (VenvyStatisticsManager.PRELOAD_FLOW == type) {
5557
submitPreLoadFlowStatisticsInfo(jsonObj);
58+
}else if (VenvyStatisticsManager.OPEN_PAGE == type || VenvyStatisticsManager.CLOSE_PAGE == type) {
59+
executeThread(jsonObj.toString());
5660
}
5761
}
5862

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoPlusController.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,4 +769,19 @@ public void downloadAdsRes(Bundle bundle) {
769769
videoAdsHandler.initData(bundle, mPlatform.getPlatformInfo().getFileProviderAuth());
770770
videoAdsHandler.execDownloadTask();
771771
}
772+
773+
public void trackPageTime(boolean isOpen, String appletId) {
774+
if (mPlatform == null) {
775+
mPlatform = initPlatform(mVideoPlusAdapter);
776+
}
777+
VenvyStatisticsManager.getInstance().init(mPlatform);
778+
JSONObject jsonObject = new JSONObject();
779+
try {
780+
jsonObject.put("type", isOpen ? String.valueOf(VenvyStatisticsManager.OPEN_PAGE) : String.valueOf(VenvyStatisticsManager.CLOSE_PAGE));
781+
jsonObject.put("appletId", appletId);
782+
} catch (JSONException e) {
783+
e.printStackTrace();
784+
}
785+
VenvyStatisticsManager.getInstance().submitCommonTrack(isOpen ? VenvyStatisticsManager.OPEN_PAGE : VenvyStatisticsManager.CLOSE_PAGE, jsonObject);
786+
}
772787
}

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoProgramToolBarView.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public void onClick(View view) {
9696
}
9797
}
9898
});
99-
10099
initVideoProgramView();
101100

102101
ivBack.setVisibility(INVISIBLE);
@@ -130,6 +129,7 @@ public void start(String appletId, String data, int type) {
130129
errorContent.setVisibility(GONE);
131130
startLoadingAnimation();
132131
videoProgramView.startVision(appletId, data, type, false, this);
132+
videoProgramView.getController().trackPageTime(true,appletId);
133133
} else {
134134
this.currentAppletId = appletId;
135135
retryContent.setVisibility(VISIBLE);
@@ -289,4 +289,8 @@ public void closeView() {
289289
}
290290
cancelLoadingAnimation();
291291
}
292+
293+
public void closed(String appletId){
294+
videoProgramView.getController().trackPageTime(false,appletId);
295+
}
292296
}

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoProgramTypeBView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public void close(String appletId, boolean needAnimation) {
222222
if (!TextUtils.isEmpty(appletId)) {
223223
VideoProgramToolBarView programView = programMap.get(appletId);
224224
if (programView != null) {
225+
programView.closed(appletId);
225226
if (needAnimation) {
226227
doExitAnimation(programView);
227228
} else {
@@ -266,6 +267,11 @@ public void closeAllProgram() {
266267
h5ProgramMap.clear();
267268
CacheConstants.setDeveloperId("");
268269
setClickable(false);
270+
271+
if (currentProgram != null) {
272+
currentProgram.closed(currentProgramId);
273+
}
274+
269275
}
270276

271277
/**

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoProgramView.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,20 @@ public void stopService(ServiceType serviceType) {
125125
}
126126
}
127127

128-
public void setAppletListener(@NonNull IAppletListener appletListener){
129-
if(controller != null){
128+
public void setAppletListener(@NonNull IAppletListener appletListener) {
129+
if (controller != null) {
130130
controller.setAppletListener(appletListener);
131131
}
132132
}
133133

134-
public void startVision(String appletId, String data, int type,boolean isH5Type,final IRouterCallback callback) {
134+
public void startVision(String appletId, String data, int type, boolean isH5Type, final IRouterCallback callback) {
135135
if (controller != null) {
136-
controller.startVisionProgram(appletId, data, type,isH5Type,callback);
136+
controller.startVisionProgram(appletId, data, type, isH5Type, callback);
137137
refreshRecentHistory(appletId);
138138
}
139139
}
140140

141-
public void refreshRecentHistory(String appletId){
141+
public void refreshRecentHistory(String appletId) {
142142
controller.refreshRecentHistory(appletId);
143143
}
144144

@@ -158,7 +158,11 @@ public int getAllOfLuaView() {
158158
return count;
159159
}
160160

161-
public void startDownloadAdsRes(Bundle bundle){
161+
public void startDownloadAdsRes(Bundle bundle) {
162162
controller.downloadAdsRes(bundle);
163163
}
164+
165+
public T getController() {
166+
return controller;
167+
}
164168
}

0 commit comments

Comments
 (0)