add trace
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.mogo.module.share.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @since 2019-1-19
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ShareConstants {
|
||||
|
||||
//埋点数据
|
||||
//分享分类
|
||||
public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
|
||||
//分享/上报按钮点击
|
||||
public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click";
|
||||
//
|
||||
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
|
||||
}
|
||||
@@ -11,9 +11,16 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.share.R;
|
||||
import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -27,12 +34,15 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
private RelativeLayout mTrafficCheckLayout;
|
||||
private RelativeLayout mRoadClosureLayout;
|
||||
private Context mContext;
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context) {
|
||||
super(context, R.style.BottomDialog);
|
||||
this.mContext = context;
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(mContext);
|
||||
|
||||
}
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context, int themeResId) {
|
||||
@@ -68,15 +78,23 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_block_layout) { //拥堵
|
||||
traceTanluData("1");
|
||||
sendShareReceiver("1");
|
||||
traceTypeData("1");
|
||||
} else if (id == R.id.oil_price_layout) {
|
||||
traceData("1");
|
||||
Intent intent = new Intent();
|
||||
intent.setData(Uri.parse("reshthing://com.zhidao.fresh.things/shareOilPrice"));
|
||||
mContext.startActivity(intent);
|
||||
traceTypeData("2");
|
||||
} else if (id == R.id.traffic_check_layout) { //交通检查
|
||||
traceData("1");
|
||||
sendShareReceiver("2");
|
||||
traceTypeData("3");
|
||||
} else if (id == R.id.road_closure_layout) { //封路
|
||||
traceData("1");
|
||||
sendShareReceiver("3");
|
||||
traceTypeData("4");
|
||||
}
|
||||
|
||||
dismiss();
|
||||
@@ -93,5 +111,34 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* type=1 路况
|
||||
* <p>
|
||||
* type=2 油价
|
||||
* <p>
|
||||
* type=3 交通检查
|
||||
* <p>
|
||||
* type=4 封路
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
private void traceTypeData(String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mAnalytics.track(ShareConstants.LAUNCHER_SHARE_TYPE, properties);
|
||||
}
|
||||
|
||||
private void traceData(String from) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("from", from);
|
||||
mAnalytics.track(ShareConstants.LAUNCHER_SHARE_TYPE, properties);
|
||||
}
|
||||
|
||||
private void traceTanluData(String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mAnalytics.track(ShareConstants.CARNET_USER_UPLOAD, properties);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user