This commit is contained in:
wangcongtao
2020-04-22 15:15:41 +08:00
parent cc118fddb4
commit 9e478e4a21
11 changed files with 279 additions and 157 deletions

View File

@@ -12,6 +12,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.entity.MarkerCarPois;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -146,46 +147,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
// 数据统计代码
final Map<String, Object> properties = new HashMap<>();
switch (mLastCheckMarker.getOwner()) {
case ServiceConst.CARD_TYPE_CARS_CHATTING:
properties.put("type", 3);
break;
case ServiceConst.CARD_TYPE_USER_DATA:
properties.put("type", 5);
break;
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
properties.put("type", 2);
break;
case ServiceConst.CARD_TYPE_NOVELTY:
MarkerShowEntity showEntity = (MarkerShowEntity) mLastCheckMarker.getObject();
Object bindObj = showEntity.getBindObj();
if (bindObj instanceof MarkerNoveltyInfo) {
switch (((MarkerNoveltyInfo) bindObj).getPoiType()) {
case MarkerPoiTypeEnum.GAS_STATION:
properties.put("type", 4);
break;
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
properties.put("type", 8);
break;
case MarkerPoiTypeEnum.ROAD_CLOSED:
properties.put("type", 7);
break;
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
properties.put("type", 9);
break;
case MarkerPoiTypeEnum.FOURS_4S:
properties.put("type", 10);
break;
}
}
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
properties.put("type", 6);
break;
properties.put( "poitype", mLastCheckMarker.getOwner() );
MarkerShowEntity showEntity = (MarkerShowEntity) mLastCheckMarker.getObject();
Object bindObj = showEntity.getBindObj();
if (bindObj instanceof MarkerNoveltyInfo) {
properties.put( "contenttype", ((MarkerNoveltyInfo) bindObj).getPoiType() );
}
MarkerServiceHandler.getMogoAnalytics().track("Launcher_Icon_Click", properties);
} catch (Exception e) {
e.printStackTrace();
}
@@ -656,49 +624,41 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
int size = onlineCarList == null ? 0 : onlineCarList.size();
fillNumberTrackEventBody(array, 3, size);
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_USER_DATA, size);
size = exploreWayList == null ? 0 : exploreWayList.size();
fillNumberTrackEventBody(array, 1, size);
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_ROAD_CONDITION, size);
size = shareMusicList == null ? 0 : shareMusicList.size();
fillNumberTrackEventBody(array, 4, size);
int num_gas_station = 0;
int num_traffic_check = 0;
int num_road_closed = 0;
int num_shop_discount = 0;
int num_fours_shop = 0;
fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_SHARE_MUSIC, size);
if (noveltyInfoList != null) {
JSONObject novelty = fillPoiTypeTrackBody(array, ModuleNames.CARD_TYPE_NOVELTY, size);
Map<String, Integer> counter = new HashMap<>( );
for (MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList) {
if (markerNoveltyInfo == null) {
continue;
}
switch (markerNoveltyInfo.getPoiType()) {
case MarkerPoiTypeEnum.GAS_STATION:
num_gas_station++;
break;
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
num_traffic_check++;
break;
case MarkerPoiTypeEnum.ROAD_CLOSED:
num_road_closed++;
break;
case MarkerPoiTypeEnum.SHOP_DISCOUNT:
num_shop_discount++;
break;
case MarkerPoiTypeEnum.FOURS_4S:
num_fours_shop++;
break;
String childType = markerNoveltyInfo.getPoiType();
if ( !counter.containsKey( childType ) ) {
counter.put( childType, 0 );
}
int s = counter.get( childType ).intValue();
counter.put( childType, s+1 );
}
if ( !counter.isEmpty() ) {
JSONArray onlineCarJsonArray = new JSONArray();
for ( Map.Entry< String, Integer > entry : counter.entrySet() ) {
fillPoiChildTypeTrackBody(onlineCarJsonArray, entry.getKey(), entry.getValue());
}
if ( onlineCarJsonArray.length() > 0 ) {
try {
novelty.put( "content", onlineCarJsonArray );
} catch ( JSONException e ) {
e.printStackTrace();
}
}
}
}
fillNumberTrackEventBody(array, 2, num_gas_station);
fillNumberTrackEventBody(array, 6, num_road_closed);
fillNumberTrackEventBody(array, 5, num_traffic_check);
fillNumberTrackEventBody(array, 7, num_shop_discount);
fillNumberTrackEventBody(array, 8, num_fours_shop);
try {
if (array.length() == 0) {
return;
@@ -750,13 +710,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
/**
* 统计埋点
* 大而全数据计数埋点
*/
private synchronized static void fillNumberTrackEventBody(JSONArray arr, int type, int size) {
private synchronized static JSONObject fillPoiTypeTrackBody( JSONArray arr, String poiType, int poiTypeNum) {
JSONObject object = new JSONObject();
try {
object.put("type", type);
object.put("num", size);
object.put("poitype", poiType);
object.put("num", poiTypeNum);
if (arr != null) {
arr.put(object);
}
return object;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
private synchronized static void fillPoiChildTypeTrackBody(JSONArray arr, String childType, int childTypeNum){
JSONObject object = new JSONObject();
try {
object.put("contenttype", childType);
object.put("num", childTypeNum);
if (arr != null) {
arr.put(object);
}