add trace

This commit is contained in:
lixiaopeng
2020-01-19 10:49:51 +08:00
parent a02cd2363e
commit 2e5826fca4
5 changed files with 122 additions and 3 deletions

View File

@@ -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";
}

View File

@@ -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);
}
}

View File

@@ -27,4 +27,15 @@ public class TanluConstants {
public static final String SHARE_TRAFFIC_CHECK = "com.zhidao.share.traffic.check";
//我要分享
public static final String GO_TO_SHARE = "com.zhidao.share";
//埋点数据
//marker点击
public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click";
//分享分类
public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
//分享/上报按钮点击 from=1 手动点击 from=2 语音打开
public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click";
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
}

View File

@@ -56,6 +56,7 @@ import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.share.ShareControl;
import com.mogo.module.share.constant.ShareConstants;
import com.mogo.module.tanlu.R;
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
import com.mogo.module.tanlu.callback.RoadLineCallback;
@@ -76,6 +77,7 @@ import com.mogo.module.tanlu.video.FullMediaActivity;
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
import com.mogo.module.tanlu.view.AutoZoomInImageView;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.imageloader.IMogoImageLoaderListener;
@@ -96,7 +98,9 @@ import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
@@ -131,6 +135,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
private IMogoIntentManager mogoIntentManager; //免唤醒
private IMogoMapUIController mMApUIController;
private GeocodeSearch mGeocodeSearch;
private IMogoAnalytics mAnalytics;
//声音控制文字
private String voiceGetInfoMationTts;
@@ -218,6 +223,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mMApUIController = mMogoMapService.getMapUIController();
mGeocodeSearch = new GeocodeSearch(getContext());
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(getContext());
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
//poi查询
mGeocodeSearch.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {
@@ -355,6 +361,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
//marker 点击
Map<String, Object> properties = new HashMap<>();
properties.put("type", "2");
mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties);
mEmptyLayout.setVisibility(View.GONE);
mRootLayout.setVisibility(View.VISIBLE);
MarkerExploreWay exploreWay = extractFromMarker(marker);
@@ -444,15 +455,20 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
e.printStackTrace();
}
} else if (intentStr.equals(TanluConstants.UPLOAD_ROAD_CONDITION)) { //上报路况 免唤醒 --ok
traceTanluData("2");
sendShareReceiver("1");
Logger.d(TAG, "mogoIntentListener 上报路况 ----> ");
traceTypeData("1");
} else if (intentStr.equals(TanluConstants.SHARE_ROAD_CLOSURE)) { //分享封路 --ok
traceData("2");
sendShareReceiver("3");
Logger.d(TAG, "mogoIntentListener 分享封路 ----> ");
traceTypeData("4");
} else if (intentStr.equals(TanluConstants.SHARE_TRAFFIC_CHECK)) { //分享交通检查 --ok
traceData("2");
sendShareReceiver("2");
Logger.d(TAG, "mogoIntentListener 分享交通检查 ----> ");
traceTypeData("3");
} else if (intentStr.equals(TanluConstants.GO_TO_SHARE)) { //我要分享 --ok
ShareControl shareControl = new ShareControl();
shareControl.showDialog(getActivity());
@@ -461,6 +477,34 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
};
/**
* 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(TanluConstants.LAUNCHER_SHARE_TYPE, properties);
}
private void traceData(String from) {
Map<String, Object> properties = new HashMap<>();
properties.put("from", from);
mAnalytics.track(TanluConstants.LAUNCHER_SHARE_CLICK, properties);
}
private void traceTanluData(String type) {
Map<String, Object> properties = new HashMap<>();
properties.put("type", type);
mAnalytics.track(TanluConstants.CARNET_USER_UPLOAD, properties);
}
/**
* 免唤醒语音监听

View File

@@ -17,8 +17,7 @@ class MarkerInfoReceiver : BroadcastReceiver() {
var imageUrl = intent.getStringExtra("imageUrl")
var lat = intent.getLongExtra("lat",0)
var lon = intent.getLongExtra("lon",0) //经度
Log.d("MarkerInfoReceiver", "type = $type ---->lat = $lat ---->lon = $lon + " )
Log.d("MarkerInfoReceiver", "")
Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + "---imageUrl =" + imageUrl)
EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat))
}
}