[android] Added statistics for downloaded bookmark popup

This commit is contained in:
Alexander Zatsepin 2018-08-06 15:55:15 +03:00 committed by Aleksey Belousov
parent 26b97dc4be
commit c530a37729
3 changed files with 27 additions and 0 deletions

View file

@ -1196,7 +1196,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
@Override
public void onImportFinished(@NonNull String serverId, long catId, boolean successful)
{
if (!successful)
return;
Toast.makeText(this, R.string.bookmarks_downloaded_title, Toast.LENGTH_LONG).show();
Statistics.INSTANCE.trackEvent(Statistics.EventName.BM_GUIDEDOWNLOADTOAST_SHOWN);
}
@Override

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps.bookmarks;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
@ -12,6 +13,7 @@ import android.view.ViewGroup;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
import com.mapswithme.util.statistics.Statistics;
public class ShowOnMapCatalogCategoryFragment extends DialogFragment
{
@ -55,11 +57,13 @@ public class ShowOnMapCatalogCategoryFragment extends DialogFragment
private void onDeclined()
{
Statistics.INSTANCE.trackDownloadBookmarkDialog(Statistics.ParamValue.NOT_NOW);
dismissAllowingStateLoss();
}
private void onAccepted()
{
Statistics.INSTANCE.trackDownloadBookmarkDialog(Statistics.ParamValue.VIEW_ON_MAP);
Intent result = new Intent().putExtra(BookmarksCatalogActivity.EXTRA_DOWNLOADED_CATEGORY,
mCategory);
getActivity().setResult(Activity.RESULT_OK, result);
@ -67,6 +71,13 @@ public class ShowOnMapCatalogCategoryFragment extends DialogFragment
getActivity().finish();
}
@Override
public void onCancel(DialogInterface dialog)
{
super.onCancel(dialog);
Statistics.INSTANCE.trackDownloadBookmarkDialog(Statistics.ParamValue.CLICK_OUTSIDE);
}
void setCategory(@NonNull BookmarkCategory category)
{
mCategory = category;

View file

@ -53,6 +53,7 @@ import static com.mapswithme.util.BatteryState.CHARGING_STATUS_PLUGGED;
import static com.mapswithme.util.BatteryState.CHARGING_STATUS_UNKNOWN;
import static com.mapswithme.util.BatteryState.CHARGING_STATUS_UNPLUGGED;
import static com.mapswithme.util.statistics.Statistics.EventName.APPLICATION_COLD_STARTUP_INFO;
import static com.mapswithme.util.statistics.Statistics.EventName.BM_GUIDES_DOWNLOADDIALOGUE_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.BM_RESTORE_PROPOSAL_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.BM_RESTORE_PROPOSAL_ERROR;
import static com.mapswithme.util.statistics.Statistics.EventName.BM_RESTORE_PROPOSAL_SUCCESS;
@ -82,6 +83,7 @@ import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_ERROR
import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_EXTERNAL_REQUEST_SUCCESS;
import static com.mapswithme.util.statistics.Statistics.EventName.UGC_AUTH_SHOWN;
import static com.mapswithme.util.statistics.Statistics.EventName.UGC_REVIEW_START;
import static com.mapswithme.util.statistics.Statistics.EventParam.ACTION;
import static com.mapswithme.util.statistics.Statistics.EventParam.BANNER;
import static com.mapswithme.util.statistics.Statistics.EventParam.BATTERY;
import static com.mapswithme.util.statistics.Statistics.EventParam.BUTTON;
@ -191,6 +193,8 @@ public enum Statistics
static final String BM_TAB_CLICK = "Bookmarks_Tab_click";
private static final String BM_DOWNLOADED_CATALOGUE_OPEN = "Bookmarks_Downloaded_Catalogue_open";
private static final String BM_DOWNLOADED_CATALOGUE_ERROR = "Bookmarks_Downloaded_Catalogue_error";
public static final String BM_GUIDEDOWNLOADTOAST_SHOWN = "Bookmarks_GuideDownloadToast_shown";
public static final String BM_GUIDES_DOWNLOADDIALOGUE_CLICK = "Bookmarks_Guides_DownloadDialogue_click";
// search
public static final String SEARCH_CAT_CLICKED = "Search. Category clicked";
@ -456,6 +460,9 @@ public enum Statistics
static final String BICYCLE = "bicycle";
static final String TAXI = "taxi";
static final String TRANSIT = "transit";
public final static String VIEW_ON_MAP = "view on map";
public final static String NOT_NOW = "not now";
public final static String CLICK_OUTSIDE = "click outside pop-up";
}
// Initialized once in constructor and does not change until the process restarts.
@ -1276,6 +1283,11 @@ public enum Statistics
trackEvent(TOOLBAR_MENU_CLICK, getToolbarParams(button));
}
public void trackDownloadBookmarkDialog(@NonNull String button)
{
trackEvent(BM_GUIDES_DOWNLOADDIALOGUE_CLICK, params().add(ACTION, button));
}
@NonNull
private static ParameterBuilder getToolbarParams(@NonNull MainMenu.Item button)
{