forked from organicmaps/organicmaps
Log UI events to Aloha stats.
This commit is contained in:
parent
fe0296574c
commit
cd1733a108
12 changed files with 123 additions and 11 deletions
|
@ -9,6 +9,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="email"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small">
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="latlon">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_latlon"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="operator"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="phone"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="schedule"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_small"
|
||||
android:paddingTop="@dimen/margin_small"
|
||||
android:tag="website"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -75,6 +75,7 @@ import com.mapswithme.util.ShareAction;
|
|||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.Yota;
|
||||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
|
@ -1318,6 +1319,7 @@ public class MWMActivity extends BaseMwmFragmentActivity
|
|||
@Override
|
||||
public void onPlacePageVisibilityChanged(boolean isVisible)
|
||||
{
|
||||
AlohaHelper.logClick(AlohaHelper.PP_OPEN);
|
||||
setVerticalToolbarVisible(false);
|
||||
if (placePageIntersectsZoomButtons())
|
||||
mNavigationButtons.setVisibility(isVisible ? View.GONE : View.VISIBLE);
|
||||
|
@ -1333,42 +1335,55 @@ public class MWMActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
switch (v.getId())
|
||||
{
|
||||
|
||||
case R.id.btn_share:
|
||||
AlohaHelper.logClick(AlohaHelper.MENU_SHARE);
|
||||
setVerticalToolbarVisible(false);
|
||||
shareMyLocation();
|
||||
break;
|
||||
case R.id.btn_settings:
|
||||
AlohaHelper.logClick(AlohaHelper.MENU_SETTINGS);
|
||||
setVerticalToolbarVisible(false);
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.btn_download_maps:
|
||||
AlohaHelper.logClick(AlohaHelper.MENU_DOWNLOADER);
|
||||
setVerticalToolbarVisible(false);
|
||||
showDownloader(false);
|
||||
break;
|
||||
case R.id.rl__route:
|
||||
AlohaHelper.logClick(AlohaHelper.PP_ROUTE);
|
||||
buildRoute();
|
||||
break;
|
||||
case R.id.iv__routing_close:
|
||||
AlohaHelper.logClick(AlohaHelper.ROUTING_GO_CLOSE);
|
||||
closeRouting();
|
||||
break;
|
||||
case R.id.btn__close:
|
||||
AlohaHelper.logClick(AlohaHelper.ROUTING_CLOSE);
|
||||
closeRouting();
|
||||
break;
|
||||
case R.id.rl__routing_go:
|
||||
AlohaHelper.logClick(AlohaHelper.ROUTING_GO);
|
||||
followRoute();
|
||||
break;
|
||||
case R.id.map_button_plus:
|
||||
AlohaHelper.logClick(AlohaHelper.ZOOM_IN);
|
||||
mMapFragment.nativeScale(3.0 / 2);
|
||||
break;
|
||||
case R.id.map_button_minus:
|
||||
AlohaHelper.logClick(AlohaHelper.ZOOM_OUT);
|
||||
mMapFragment.nativeScale(2 / 3.0);
|
||||
break;
|
||||
case R.id.btn__more:
|
||||
AlohaHelper.logClick(AlohaHelper.TOOLBAR_MENU);
|
||||
setVerticalToolbarVisible(true);
|
||||
break;
|
||||
case R.id.btn__search:
|
||||
AlohaHelper.logClick(AlohaHelper.TOOLBAR_SEARCH);
|
||||
showSearchIfUpdated();
|
||||
break;
|
||||
case R.id.btn__bookmarks:
|
||||
AlohaHelper.logClick(AlohaHelper.TOOLBAR_BOOKMARKS);
|
||||
showBookmarks();
|
||||
break;
|
||||
case R.id.btn__myposition:
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.mapswithme.util.Constants;
|
|||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.Yota;
|
||||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import ru.mail.mrgservice.MRGService;
|
||||
|
@ -305,26 +306,29 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
if (key.equals(getString(R.string.pref_rate_app)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_RATE);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_RATE);
|
||||
UiUtils.openAppInMarket(this, BuildConfig.REVIEW_URL);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_contact)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.MAIL_INFO);
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_CONTACT_US);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_CONTACT_US);
|
||||
final Intent intent = new Intent(Intent.ACTION_SENDTO);
|
||||
intent.setData(Utils.buildMailUri(Constants.Url.MAIL_MAPSME_INFO, "", ""));
|
||||
startActivity(intent);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_subscribe)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.MAIL_SUBSCRIBE);
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_MAIL_SUBSCRIBE);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_MAIL_SUBSCRIBE);
|
||||
final Intent intent = new Intent(Intent.ACTION_SENDTO);
|
||||
intent.setData(Utils.buildMailUri(Constants.Url.MAIL_MAPSME_SUBSCRIBE, getString(R.string.subscribe_me_subject), getString(R.string.subscribe_me_body)));
|
||||
startActivity(intent);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_report_bug)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.REPORT_BUG);
|
||||
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_REPORT_BUG);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_REPORT_BUG);
|
||||
final Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{BuildConfig.SUPPORT_MAIL});
|
||||
|
@ -337,26 +341,31 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
else if (key.equals(getString(R.string.pref_like_fb)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_FB);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_FB);
|
||||
UiUtils.showFacebookPage(this);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_follow_twitter)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_TWITTER);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_TWITTER);
|
||||
UiUtils.showTwitterPage(this);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_help)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_HELP);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_HELP);
|
||||
showWebViewDialogWithUrl(FAQ_HTML_URL, getString(R.string.help));
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_copyright)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_COPYRIGHT);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_COPYRIGHT);
|
||||
showWebViewDialogWithUrl(COPYRIGHT_HTML_URL, getString(R.string.copyright));
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_about)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_ABOUT);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_ABOUT);
|
||||
showDialogWithData(getString(R.string.about_text),
|
||||
String.format(getString(R.string.version), BuildConfig.VERSION_NAME));
|
||||
}
|
||||
|
@ -386,6 +395,13 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_community)))
|
||||
{
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_COMMUNITY);
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_COMMUNITY);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_settings)))
|
||||
Statistics.INSTANCE.trackSimpleNamedEvent(Statistics.EventName.SETTINGS_CHANGE_SETTING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -395,7 +411,10 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
{
|
||||
final String key = preference.getKey();
|
||||
if (key.equals(getString(R.string.pref_munits)))
|
||||
{
|
||||
UnitLocale.setUnits(Integer.parseInt((String) newValue));
|
||||
AlohaHelper.logClick(AlohaHelper.SETTINGS_CHANGE_UNITS);
|
||||
}
|
||||
else if (key.equals(getString(R.string.pref_allow_stat)))
|
||||
Statistics.INSTANCE.setStatEnabled((Boolean) newValue);
|
||||
else if (key.equals(getString(R.string.pref_zoom_btns_enabled)))
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.mapswithme.maps.bookmarks.data.MapObject;
|
|||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.maps.widget.ArrowView;
|
||||
import com.mapswithme.util.LocationUtils;
|
||||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
|
||||
public class DirectionFragment extends DialogFragment implements LocationHelper.LocationListener
|
||||
{
|
||||
|
@ -46,6 +47,7 @@ public class DirectionFragment extends DialogFragment implements LocationHelper.
|
|||
public boolean onTouch(View v, MotionEvent event)
|
||||
{
|
||||
dismiss();
|
||||
AlohaHelper.logClick(AlohaHelper.PP_DIRECTION_ARROW_CLOSE);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.mapswithme.util.InputUtils;
|
|||
import com.mapswithme.util.LocationUtils;
|
||||
import com.mapswithme.util.ShareAction;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -606,9 +607,11 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
selectBookmarkColor();
|
||||
break;
|
||||
case R.id.rl__bookmark:
|
||||
AlohaHelper.logClick(AlohaHelper.PP_BOOKMARK);
|
||||
toggleIsBookmark();
|
||||
break;
|
||||
case R.id.rl__share:
|
||||
AlohaHelper.logClick(AlohaHelper.PP_SHARE);
|
||||
ShareAction.getAnyShare().shareMapObject((Activity) getContext(), mMapObject);
|
||||
break;
|
||||
case R.id.rl__api_back:
|
||||
|
@ -652,6 +655,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
selectBookmarkSet();
|
||||
break;
|
||||
case R.id.av__direction:
|
||||
AlohaHelper.logClick(AlohaHelper.PP_DIRECTION_ARROW);
|
||||
showBigDirection();
|
||||
break;
|
||||
case R.id.ll__place_email:
|
||||
|
@ -741,6 +745,10 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
final Object tag = v.getTag();
|
||||
final String tagStr = tag == null ? "" : tag.toString();
|
||||
AlohaHelper.logLongClick(tagStr);
|
||||
|
||||
final PopupMenu popup = new PopupMenu(getContext(), v);
|
||||
final Menu menu = popup.getMenu();
|
||||
final List<String> items = new ArrayList<>();
|
||||
|
@ -784,6 +792,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
final Context ctx = getContext();
|
||||
Utils.copyTextToClipboard(ctx, items.get(id));
|
||||
Utils.toastShortcut(ctx, ctx.getString(R.string.copied_to_clipboard, items.get(id)));
|
||||
AlohaHelper.logClick(AlohaHelper.PP_METADATA_COPY + ":" + tagStr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
57
android/src/com/mapswithme/util/statistics/AlohaHelper.java
Normal file
57
android/src/com/mapswithme/util/statistics/AlohaHelper.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package com.mapswithme.util.statistics;
|
||||
|
||||
public class AlohaHelper
|
||||
{
|
||||
private AlohaHelper() {}
|
||||
|
||||
public static void logClick(String element)
|
||||
{
|
||||
org.alohalytics.Statistics.logEvent(ALOHA_CLICK, element);
|
||||
}
|
||||
|
||||
public static void logLongClick(String element)
|
||||
{
|
||||
org.alohalytics.Statistics.logEvent(ALOHA_LONG_CLICK, element);
|
||||
}
|
||||
|
||||
public static final String SETTINGS_CONTACT_US = "contactUs";
|
||||
public static final String SETTINGS_MAIL_SUBSCRIBE = "subscribeToNews";
|
||||
public static final String SETTINGS_REPORT_BUG = "reportABug";
|
||||
public static final String SETTINGS_RATE = "rate";
|
||||
public static final String SETTINGS_FB = "likeOnFb";
|
||||
public static final String SETTINGS_TWITTER = "followOnTwitter";
|
||||
public static final String SETTINGS_HELP = "help";
|
||||
public static final String SETTINGS_ABOUT = "about";
|
||||
public static final String SETTINGS_COPYRIGHT = "copyright";
|
||||
public static final String SETTINGS_COMMUNITY = "community";
|
||||
public static final String SETTINGS_CHANGE_UNITS = "settingsMiles";
|
||||
// for aloha stats
|
||||
public static final String ALOHA_CLICK = "$onClick";
|
||||
public static final String ALOHA_LONG_CLICK = "$onLongClick";
|
||||
public static final String ZOOM_IN = "+";
|
||||
public static final String ZOOM_OUT = "-";
|
||||
// toolbar actions
|
||||
public static final String TOOLBAR_MY_POSITION = "MyPosition";
|
||||
public static final String TOOLBAR_SEARCH = "search";
|
||||
public static final String TOOLBAR_MENU = "menu";
|
||||
public static final String TOOLBAR_BOOKMARKS = "bookmarks";
|
||||
// menu actions
|
||||
public static final String MENU_DOWNLOADER = "downloader";
|
||||
public static final String MENU_SETTINGS = "settingsAndMore";
|
||||
public static final String MENU_SHARE = "share@";
|
||||
// place page
|
||||
public static final String PP_OPEN = "ppOpen";
|
||||
public static final String PP_SHARE = "ppShare";
|
||||
public static final String PP_BOOKMARK = "ppBookmark";
|
||||
public static final String PP_ROUTE = "ppRoute";
|
||||
// place page details
|
||||
public static final String PP_DIRECTION_ARROW = "ppDirectionArrow";
|
||||
public static final String PP_DIRECTION_ARROW_CLOSE = "ppDirectionArrowClose";
|
||||
public static final String PP_METADATA_COPY = "ppCopyMetadata";
|
||||
// routing
|
||||
public static final String ROUTING_CLOSE = "routeClose";
|
||||
public static final String ROUTING_GO = "routeGo";
|
||||
public static final String ROUTING_GO_CLOSE = "routeGoClose";
|
||||
// search
|
||||
public static final String SEARCH_CANCEL = "searchCancel";
|
||||
}
|
|
@ -31,8 +31,8 @@ public enum Statistics
|
|||
private final Logger mLogger = BuildConfig.DEBUG ? SimpleLogger.get("MwmStatistics") : StubLogger.get();
|
||||
|
||||
// Statistics counters
|
||||
private int mBookmarksCreated = 0;
|
||||
private int mSharedTimes = 0;
|
||||
private int mBookmarksCreated;
|
||||
private int mSharedTimes;
|
||||
|
||||
public static class EventName
|
||||
{
|
||||
|
@ -52,18 +52,22 @@ public enum Statistics
|
|||
public static final String WIFI_CONNECTED = "Wifi connected";
|
||||
public static final String DOWNLOAD_COUNTRY_NOTIFICATION_SHOWN = "Download country notification shown";
|
||||
public static final String DOWNLOAD_COUNTRY_NOTIFICATION_CLICKED = "Download country notification clicked";
|
||||
// settings
|
||||
public static final String SETTINGS_CONTACT_US = "Send mail at info@maps.me";
|
||||
public static final String SETTINGS_MAIL_SUBSCRIBE = "Settings. Subscribed";
|
||||
public static final String SETTINGS_REPORT_BUG = "Settings. Bug reported";
|
||||
public static final String SETTINGS_RATE = "Settings. Rate app called";
|
||||
public static final String MAIL_INFO = "Send mail at info@maps.me";
|
||||
public static final String MAIL_SUBSCRIBE = "Settings. Subscribed";
|
||||
public static final String REPORT_BUG = "Settings. Bug reported";
|
||||
public static final String SETTINGS_FB = "Settings. Go to FB.";
|
||||
public static final String SETTINGS_TWITTER = "Settings. Go to twitter.";
|
||||
public static final String SETTINGS_HELP = "Settings. Help.";
|
||||
public static final String SETTINGS_ABOUT = "Settings. About.";
|
||||
public static final String SETTINGS_COPYRIGHT = "Settings. Copyright.";
|
||||
public static final String SETTINGS_COMMUNITY = "Settings. Community.";
|
||||
public static final String SETTINGS_CHANGE_SETTING= "Settings. Change settings.";
|
||||
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";
|
||||
//
|
||||
public static final String NO_FREE_SPACE = "Downloader. Not enough free space.";
|
||||
public static final String APP_ACTIVATED = "Application activated.";
|
||||
public static final String PLUS_DIALOG_LATER = "GPlus dialog cancelled.";
|
||||
|
|
Loading…
Add table
Reference in a new issue