[android] Log events from route planning.

This commit is contained in:
Dmitry Yunitsky 2015-11-18 11:06:30 +03:00 committed by Alexander Marchuk
parent 04b4bc2d7c
commit 02a4e695e7
5 changed files with 56 additions and 4 deletions

View file

@ -13,6 +13,7 @@ import com.mapswithme.maps.widget.FlatProgressView;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
public class NavigationController
{
@ -53,6 +54,7 @@ public class NavigationController
public void onClick(View v)
{
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_CLOSE);
RoutingController.get().cancel();
}
});

View file

@ -17,6 +17,8 @@ import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.util.Config;
import com.mapswithme.util.Utils;
import com.mapswithme.util.concurrency.UiThread;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
import java.util.Calendar;
import java.util.Locale;
@ -246,6 +248,10 @@ public class RoutingController
setBuildState(BuildState.BUILDING);
updatePlan();
Statistics.INSTANCE.trackRouteBuild(Statistics.getPointType(mStartPoint), Statistics.getPointType(mEndPoint));
org.alohalytics.Statistics.logEvent(AlohaHelper.ROUTING_BUILD, new String[] {Statistics.EventParam.FROM, Statistics.getPointType(mStartPoint),
Statistics.EventParam.TO, Statistics.getPointType(mEndPoint)});
Framework.nativeBuildRoute(mStartPoint.getLat(), mStartPoint.getLon(), mEndPoint.getLat(), mEndPoint.getLon());
}
@ -324,10 +330,14 @@ public class RoutingController
if (!(mStartPoint instanceof MapObject.MyPosition))
{
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_START_SUGGEST_REBUILD);
AlohaHelper.logClick(AlohaHelper.ROUTING_GO_SUGGEST_REBUILD);
suggestRebuildRoute();
return;
}
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_START);
AlohaHelper.logClick(AlohaHelper.ROUTING_GO);
setState(State.NAVIGATION);
Framework.nativeFollowRoute();
@ -615,6 +625,9 @@ public class RoutingController
mStartPoint = mEndPoint;
mEndPoint = point;
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_SWAP_POINTS);
AlohaHelper.logClick(AlohaHelper.ROUTING_SWAP_POINTS);
checkAndBuildRoute();
}
@ -635,6 +648,8 @@ public class RoutingController
public void searchPoi(int slotId)
{
Log.d(TAG, "searchPoi: " + slotId);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_SEARCH_POINT);
AlohaHelper.logClick(AlohaHelper.ROUTING_SEARCH_POINT);
mWaitingPoiPickSlot = slotId;
mContainer.showSearch();
mContainer.updateMenu();

View file

@ -16,6 +16,7 @@ import com.mapswithme.maps.widget.WheelProgressView;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.statistics.AlohaHelper;
import com.mapswithme.util.statistics.Statistics;
public class RoutingPlanController extends ToolbarController
{
@ -63,6 +64,7 @@ public class RoutingPlanController extends ToolbarController
public void onClick(View v)
{
AlohaHelper.logClick(AlohaHelper.ROUTING_VEHICLE_SET);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_VEHICLE_SET);
RoutingController.get().setRouterType(Framework.ROUTER_TYPE_VEHICLE);
}
});
@ -73,6 +75,7 @@ public class RoutingPlanController extends ToolbarController
public void onClick(View v)
{
AlohaHelper.logClick(AlohaHelper.ROUTING_PEDESTRIAN_SET);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_PEDESTRIAN_SET);
RoutingController.get().setRouterType(Framework.ROUTER_TYPE_PEDESTRIAN);
}
});
@ -103,7 +106,8 @@ public class RoutingPlanController extends ToolbarController
@Override
public void onUpClick()
{
AlohaHelper.logClick(AlohaHelper.ROUTING_GO_CLOSE);
AlohaHelper.logClick(AlohaHelper.ROUTING_CANCEL);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_CANCEL);
RoutingController.get().cancelPlanning();
}
@ -171,6 +175,8 @@ public class RoutingPlanController extends ToolbarController
private void toggleSlots()
{
AlohaHelper.logClick(AlohaHelper.ROUTING_TOGGLE);
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.ROUTING_TOGGLE);
showSlots(!mOpen, true);
}

View file

@ -65,13 +65,16 @@ public class AlohaHelper
public static final String PP_DIRECTION_ARROW_CLOSE = "ppDirectionArrowClose";
public static final String PP_METADATA_COPY = "ppCopyMetadata";
// routing
public static final String ROUTING_BUILD = "routeBuild";
public static final String ROUTING_CLOSE = "routeClose";
public static final String ROUTING_GO = "routeGo";
public static final String ROUTING_GO_CLOSE = "routeGoClose";
public static final String ROUTING_PROGRESS_CLOSE = "routeProgressClose";
public static final String ROUTING_GO_SUGGEST_REBUILD = "routeGoRebuild";
public static final String ROUTING_CANCEL = "routeCancel";
public static final String ROUTING_PEDESTRIAN_SET = "routerSetPedestrian";
public static final String ROUTING_VEHICLE_SET = "routerSetVehicle";
public static final String ROUTING_SWAP_POINTS = "routeSwapPoints";
public static final String ROUTING_TOGGLE = "routeToggle";
public static final String ROUTING_SEARCH_POINT = "routSearchPoint";
// search
public static final String SEARCH_CANCEL = "searchCancel";
// installation of Parse

View file

@ -14,6 +14,7 @@ import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.PrivateVariables;
import com.mapswithme.maps.api.ParsedMwmRequest;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.util.Config;
import com.mapswithme.util.ConnectionState;
import com.mapswithme.util.log.Logger;
@ -79,12 +80,23 @@ public enum Statistics
public static final String SEARCH_KEY_CLICKED = "Search key pressed.";
public static final String SEARCH_ON_MAP_CLICKED = "Search on map clicked.";
public static final String STATISTICS_STATUS_CHANGED = "Statistics status changed";
//
// dialogs
public static final String PLUS_DIALOG_LATER = "GPlus dialog cancelled.";
public static final String RATE_DIALOG_LATER = "GPlay dialog cancelled.";
public static final String FACEBOOK_INVITE_LATER = "Facebook invites dialog cancelled.";
public static final String FACEBOOK_INVITE_INVITED = "GPlay dialog cancelled.";
public static final String RATE_DIALOG_RATED = "GPlay dialog. Rating set";
// routing
public static final String ROUTING_BUILD = "Routing. Build";
public static final String ROUTING_START_SUGGEST_REBUILD = "Routing. Suggest rebuild";
public static final String ROUTING_START = "Routing. Start";
public static final String ROUTING_CLOSE = "Routing. Close";
public static final String ROUTING_CANCEL = "Routing. Cancel";
public static final String ROUTING_PEDESTRIAN_SET = "Routing. Set pedestrian";
public static final String ROUTING_VEHICLE_SET = "Routing. Set vehicle";
public static final String ROUTING_SWAP_POINTS = "Routing. Swap points";
public static final String ROUTING_TOGGLE = "Routing. Toggle";
public static final String ROUTING_SEARCH_POINT = "Routing. Search point";
private EventName() {}
}
@ -104,6 +116,8 @@ public enum Statistics
public static final String CONNECTION_TYPE = "Connection name";
public static final String CONNECTION_FAST = "Connection fast";
public static final String CONNECTION_METERED = "Connection limit";
public static final String MY_POSITION = "my position";
public static final String POINT = "point";
private EventParam() {}
}
@ -113,6 +127,8 @@ public enum Statistics
private static final String MY_MAP_DOWNLOAD = "DownloadMap";
private static final String MY_MAP_UPDATE = "UpdateMap";
private static final String MY_TOTAL_COUNT = "Count";
private MyTrackerParams() {}
}
// Initialized once in constructor and does not change until the process restarts.
@ -266,6 +282,11 @@ public enum Statistics
post(EventName.ACTIVE_CONNECTION, new String[]{EventParam.CONNECTION_TYPE, "Not connected."});
}
public void trackRouteBuild(String from, String to)
{
post(EventName.ROUTING_BUILD, new String[]{EventParam.FROM, from, EventParam.TO, to});
}
public void myTrackerTrackMapDownload()
{
myTrackerTrackMapChange(MyTrackerParams.MY_MAP_DOWNLOAD);
@ -341,4 +362,9 @@ public enum Statistics
post(EventName.STATISTICS_STATUS_CHANGED + " " + Config.getInstallFlavor(),
new String[] { EventParam.ENABLED, String.valueOf(isEnabled) });
}
public static String getPointType(MapObject point)
{
return point instanceof MapObject.MyPosition ? Statistics.EventParam.MY_POSITION : Statistics.EventParam.POINT;
}
}