forked from organicmaps/organicmaps
[android] Added more stats for dialog after booking
This commit is contained in:
parent
189dfb1066
commit
02911041dd
12 changed files with 155 additions and 17 deletions
|
@ -2245,7 +2245,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
fragment.show(getSupportFragmentManager(), dialogName);
|
||||
|
||||
UserActionsLogger.logPromoAfterBookingShown(promo.getId());
|
||||
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.INAPP_SUGGESTION_SHOWN,
|
||||
Statistics.makeInAppSuggestionParamBuilder());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,9 +298,8 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove
|
|||
return;
|
||||
|
||||
String url = promoCityGallery.getMoreUrl();
|
||||
ItemSelectedListener<PromoEntity> listener = new RegularCatalogPromoListener(requireActivity());
|
||||
List<PromoEntity> data = PlacePageView.toEntities(promoCityGallery);
|
||||
GalleryAdapter adapter = Factory.createCatalogPromoAdapter(requireContext(), data, url, listener, DISCOVERY);
|
||||
ItemSelectedListener<PromoEntity> listener = new RegularCatalogPromoListener(requireActivity(), DISCOVERY);
|
||||
GalleryAdapter adapter = Factory.createCatalogPromoAdapter(requireContext(), promoCityGallery, url, listener, DISCOVERY);
|
||||
RecyclerView recycler = getGallery(R.id.catalog_promo_recycler);
|
||||
recycler.setAdapter(adapter);
|
||||
}
|
||||
|
|
|
@ -38,4 +38,10 @@ public final class DownloaderPromoBanner
|
|||
|
||||
@NonNull
|
||||
public String getUrl() { return mUrl; }
|
||||
|
||||
@NonNull
|
||||
public DownloaderPromoBannerStats getStatsProvider()
|
||||
{
|
||||
return DownloaderPromoBannerStats.values()[getType()];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.mapswithme.maps.downloader;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
public enum DownloaderPromoBannerStats
|
||||
{
|
||||
NO_PROMO
|
||||
{
|
||||
@NonNull
|
||||
@Override
|
||||
public String getValue()
|
||||
{
|
||||
throw new UnsupportedOperationException("Unsupported here");
|
||||
}
|
||||
},
|
||||
CATALOG
|
||||
{
|
||||
@NonNull
|
||||
@Override
|
||||
public String getValue()
|
||||
{
|
||||
return Statistics.ParamValue.MAPSME_GUIDES;
|
||||
}
|
||||
},
|
||||
MEGAFON
|
||||
{
|
||||
@NonNull
|
||||
@Override
|
||||
public String getValue()
|
||||
{
|
||||
return Statistics.ParamValue.MEGAFON;
|
||||
}
|
||||
};
|
||||
|
||||
@NonNull
|
||||
public abstract String getValue();
|
||||
}
|
|
@ -249,6 +249,10 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
mFrame.findViewById(R.id.banner_button).setOnClickListener(v -> {
|
||||
if (mPromoBanner != null && mPromoBanner.getType() != DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_NO_PROMO)
|
||||
Utils.openUrl(mActivity, mPromoBanner.getUrl());
|
||||
|
||||
Statistics.ParameterBuilder builder =
|
||||
Statistics.makeDownloaderBannerParamBuilder(Statistics.ParamValue.MEGAFON);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.DOWNLOADER_BANNER_CLICK, builder);
|
||||
});
|
||||
|
||||
View downloadGuidesBtn = mFrame.findViewById(R.id.catalog_call_to_action_btn);
|
||||
|
@ -279,6 +283,12 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
|
||||
UiUtils.showIf(isDownloading && hasMegafonPromo, mFrame, R.id.banner);
|
||||
UiUtils.showIf(isDownloading && hasCatalogPromo, mCatalogCallToActionContainer);
|
||||
|
||||
|
||||
Statistics.ParameterBuilder builder =
|
||||
Statistics.makeDownloaderBannerParamBuilder(mPromoBanner.getStatsProvider().getValue());
|
||||
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.DOWNLOADER_BANNER_SHOW, builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -328,6 +338,9 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
return;
|
||||
|
||||
BookmarksCatalogActivity.start(mActivity, mPromoBanner.getUrl());
|
||||
Statistics.ParameterBuilder builder =
|
||||
Statistics.makeDownloaderBannerParamBuilder(Statistics.ParamValue.MAPSME_GUIDES);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.DOWNLOADER_BANNER_CLICK, builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,10 @@ import com.mapswithme.maps.gallery.Constants;
|
|||
import com.mapswithme.maps.gallery.GalleryAdapter;
|
||||
import com.mapswithme.maps.gallery.ItemSelectedListener;
|
||||
import com.mapswithme.maps.gallery.Items;
|
||||
import com.mapswithme.maps.promo.PromoCityGallery;
|
||||
import com.mapswithme.maps.promo.PromoEntity;
|
||||
import com.mapswithme.maps.search.SearchResult;
|
||||
import com.mapswithme.maps.widget.placepage.PlacePageView;
|
||||
import com.mapswithme.util.statistics.GalleryPlacement;
|
||||
import com.mapswithme.util.statistics.GalleryState;
|
||||
import com.mapswithme.util.statistics.GalleryType;
|
||||
|
@ -86,7 +88,7 @@ public class Factory
|
|||
|
||||
@NonNull
|
||||
public static GalleryAdapter createCatalogPromoAdapter(@NonNull Context context,
|
||||
@NonNull List<PromoEntity> items,
|
||||
@NonNull PromoCityGallery gallery,
|
||||
@Nullable String url,
|
||||
@Nullable ItemSelectedListener<PromoEntity> listener,
|
||||
@NonNull GalleryPlacement placement)
|
||||
|
@ -95,9 +97,11 @@ public class Factory
|
|||
PromoEntity item = new PromoEntity(Constants.TYPE_MORE,
|
||||
context.getString(R.string.placepage_more_button),
|
||||
null, url, null, null);
|
||||
CatalogPromoAdapterStrategy strategy = new CatalogPromoAdapterStrategy(items,
|
||||
List<PromoEntity> entities = PlacePageView.toEntities(gallery);
|
||||
CatalogPromoAdapterStrategy strategy = new CatalogPromoAdapterStrategy(entities,
|
||||
item,
|
||||
listener);
|
||||
trackProductGalleryShownOrError(gallery.getItems(), GalleryType.PROMO, ONLINE, placement);
|
||||
return new GalleryAdapter<>(strategy);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,27 +6,39 @@ import android.support.annotation.NonNull;
|
|||
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
|
||||
import com.mapswithme.maps.gallery.ItemSelectedListener;
|
||||
import com.mapswithme.maps.promo.PromoEntity;
|
||||
import com.mapswithme.util.statistics.Destination;
|
||||
import com.mapswithme.util.statistics.GalleryPlacement;
|
||||
import com.mapswithme.util.statistics.GalleryType;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
public class RegularCatalogPromoListener implements ItemSelectedListener<PromoEntity>
|
||||
{
|
||||
@NonNull
|
||||
private final Activity mActivity;
|
||||
@NonNull
|
||||
private final GalleryPlacement mPlacement;
|
||||
|
||||
public RegularCatalogPromoListener(@NonNull Activity activity)
|
||||
public RegularCatalogPromoListener(@NonNull Activity activity, @NonNull GalleryPlacement placement)
|
||||
{
|
||||
mActivity = activity;
|
||||
mPlacement = placement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(@NonNull PromoEntity item, int position)
|
||||
{
|
||||
BookmarksCatalogActivity.startByGuidesPageDeeplink(mActivity, item.getUrl());
|
||||
Statistics.INSTANCE.trackGalleryProductItemSelected(GalleryType.PROMO, mPlacement, position,
|
||||
Destination.CATALOGUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoreItemSelected(@NonNull PromoEntity item)
|
||||
{
|
||||
BookmarksCatalogActivity.startByGuidesPageDeeplink(mActivity, item.getUrl());
|
||||
Statistics.INSTANCE.trackGalleryEvent(Statistics.EventName.PP_SPONSOR_MORE_SELECTED,
|
||||
GalleryType.PROMO,
|
||||
mPlacement);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.mapswithme.maps.promo;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -14,6 +14,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.base.BaseMwmDialogFragment;
|
||||
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
public class PromoBookingDialogFragment extends BaseMwmDialogFragment
|
||||
{
|
||||
|
@ -45,7 +46,7 @@ public class PromoBookingDialogFragment extends BaseMwmDialogFragment
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
View cancel = view.findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(v -> dismissAllowingStateLoss());
|
||||
cancel.setOnClickListener(new CloseClickListener());
|
||||
|
||||
if (!readArguments())
|
||||
return;
|
||||
|
@ -83,11 +84,38 @@ public class PromoBookingDialogFragment extends BaseMwmDialogFragment
|
|||
|
||||
private void onCityGuidesClick()
|
||||
{
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity == null || mCityGuidesUrl == null)
|
||||
if (mCityGuidesUrl == null)
|
||||
return;
|
||||
|
||||
BookmarksCatalogActivity.start(activity, mCityGuidesUrl);
|
||||
BookmarksCatalogActivity.start(requireActivity(), mCityGuidesUrl);
|
||||
dismissAllowingStateLoss();
|
||||
|
||||
Statistics.ParameterBuilder builder = Statistics.makeInAppSuggestionParamBuilder();
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.INAPP_SUGGESTION_CLICKED, builder);
|
||||
}
|
||||
|
||||
private void trackCloseStats(@NonNull String value)
|
||||
{
|
||||
Statistics.ParameterBuilder builder = Statistics.makeInAppSuggestionParamBuilder()
|
||||
.add(Statistics.EventParam.OPTION, value);
|
||||
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.INAPP_SUGGESTION_CLOSED, builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog)
|
||||
{
|
||||
super.onCancel(dialog);
|
||||
trackCloseStats(Statistics.ParamValue.OFFSCREEEN);
|
||||
}
|
||||
|
||||
private class CloseClickListener implements View.OnClickListener
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
dismissAllowingStateLoss();
|
||||
trackCloseStats(Statistics.ParamValue.CANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -383,10 +383,10 @@ public class PlacePageView extends NestedScrollView
|
|||
public void onCityGalleryReceived(@NonNull PromoCityGallery gallery)
|
||||
{
|
||||
String url = gallery.getMoreUrl();
|
||||
List<PromoEntity> items = toEntities(gallery);
|
||||
RegularCatalogPromoListener promoListener = new RegularCatalogPromoListener(getActivity());
|
||||
RegularCatalogPromoListener promoListener = new RegularCatalogPromoListener(getActivity(),
|
||||
GalleryPlacement.PLACEPAGE);
|
||||
com.mapswithme.maps.gallery.GalleryAdapter adapter = Factory.createCatalogPromoAdapter(getContext(),
|
||||
items,
|
||||
gallery,
|
||||
url,
|
||||
promoListener,
|
||||
GalleryPlacement.PLACEPAGE);
|
||||
|
|
|
@ -5,5 +5,6 @@ public enum Destination
|
|||
ROUTING,
|
||||
PLACEPAGE,
|
||||
SEARCH,
|
||||
EXTERNAL;
|
||||
EXTERNAL,
|
||||
CATALOGUE
|
||||
}
|
||||
|
|
|
@ -39,6 +39,15 @@ public enum GalleryType
|
|||
{
|
||||
return Statistics.ParamValue.BOOKING_COM;
|
||||
}
|
||||
},
|
||||
PROMO
|
||||
{
|
||||
@NonNull
|
||||
@Override
|
||||
public String getProvider()
|
||||
{
|
||||
return Statistics.ParamValue.MAPSME_GUIDES;
|
||||
}
|
||||
};
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -159,6 +159,22 @@ public enum Statistics
|
|||
{
|
||||
INSTANCE;
|
||||
|
||||
@NonNull
|
||||
public static ParameterBuilder makeInAppSuggestionParamBuilder()
|
||||
{
|
||||
return new ParameterBuilder()
|
||||
.add(EventParam.SCENARIO, BOOKING_COM)
|
||||
.add(PROVIDER, MAPSME_GUIDES);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static ParameterBuilder makeDownloaderBannerParamBuilder(@NonNull String provider)
|
||||
{
|
||||
return new ParameterBuilder()
|
||||
.add(EventParam.FROM, ParamValue.MAP)
|
||||
.add(PROVIDER, provider);
|
||||
}
|
||||
|
||||
public void trackCategoryDescChanged()
|
||||
{
|
||||
trackEditSettingsScreenOptionClick(ParamValue.ADD_DESC);
|
||||
|
@ -273,6 +289,8 @@ public enum Statistics
|
|||
public static final String PLACEPAGE_DESCRIPTION_MORE = "Placepage_Description_more";
|
||||
public static final String PLACEPAGE_DESCRIPTION_OUTBOUND_CLICK = "Placepage_Description_Outbound_click";
|
||||
public static final String SETTINGS_SPEED_CAMS = "Settings. Speed_cameras";
|
||||
public static final String DOWNLOADER_BANNER_SHOW = "Downloader_Banner_show";
|
||||
public static final String DOWNLOADER_BANNER_CLICK = "Downloader_Banner_click";
|
||||
static final String DOWNLOADER_DIALOG_ERROR = "Downloader_OnStartScreen_error";
|
||||
|
||||
// bookmarks
|
||||
|
@ -453,6 +471,10 @@ public enum Statistics
|
|||
public static final String TIPS_TRICKS_CLOSE = "TipsTricks_close";
|
||||
public static final String TIPS_TRICKS_CLICK = "TipsTricks_click";
|
||||
|
||||
public static final String INAPP_SUGGESTION_SHOWN = "MapsMe_InAppSuggestion_shown";
|
||||
public static final String INAPP_SUGGESTION_CLICKED = "MapsMe_InAppSuggestion_clicked";
|
||||
public static final String INAPP_SUGGESTION_CLOSED = "MapsMe_InAppSuggestion_closed";
|
||||
|
||||
public static class Settings
|
||||
{
|
||||
public static final String WEB_SITE = "Setings. Go to website";
|
||||
|
@ -493,6 +515,7 @@ public enum Statistics
|
|||
public static final String MOTORWAY = "motorway";
|
||||
public static final String SETTINGS = "settings";
|
||||
public static final String ROUTE = "route";
|
||||
public static final String SCENARIO = "scenario";
|
||||
static final String CATEGORY = "category";
|
||||
public static final String TAB = "tab";
|
||||
static final String COUNT = "Count";
|
||||
|
@ -572,6 +595,9 @@ public enum Statistics
|
|||
public static final String PUBLIC = "public";
|
||||
public static final String PRIVATE = "private";
|
||||
public static final String COPY_LINK = "copy_link";
|
||||
public static final String CANCEL = "Cancel";
|
||||
public static final String MEGAFON = "Megafon";
|
||||
public static final String MAP = "map";
|
||||
static final String SEARCH_BOOKING_COM = "Search.Booking.Com";
|
||||
static final String OPENTABLE = "OpenTable";
|
||||
static final String LOCALS_EXPERTS = "Locals.Maps.Me";
|
||||
|
@ -623,7 +649,7 @@ public enum Statistics
|
|||
public static final String LIST_SETTINGS = "list_settings";
|
||||
public static final String DELETE_GROUP = "delete_group";
|
||||
public static final String OFFSCREEEN = "Offscreen";
|
||||
static final String MAPSME_GUIDES = "MapsMeGuides";
|
||||
public static final String MAPSME_GUIDES = "MapsMeGuides";
|
||||
static final String PARTNER = "Partner";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue