From f222592fdc4539c628acf22c04baef338116c6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Sat, 14 Sep 2019 11:55:22 +0300 Subject: [PATCH] [android] Added statistic for sight seeings in pp and added new gallery placements --- .../bookmarks/PlaceDescriptionActivity.java | 8 +- .../mapswithme/maps/gallery/impl/Factory.java | 5 +- .../maps/promo/CatalogPromoController.java | 99 +++++++++++++++---- .../maps/widget/placepage/PlacePageView.java | 4 +- .../util/statistics/GalleryPlacement.java | 4 +- .../util/statistics/Statistics.java | 10 +- 6 files changed, 100 insertions(+), 30 deletions(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/PlaceDescriptionActivity.java b/android/src/com/mapswithme/maps/bookmarks/PlaceDescriptionActivity.java index 64ff1af426..8b31125639 100644 --- a/android/src/com/mapswithme/maps/bookmarks/PlaceDescriptionActivity.java +++ b/android/src/com/mapswithme/maps/bookmarks/PlaceDescriptionActivity.java @@ -6,6 +6,7 @@ import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import com.mapswithme.maps.base.BaseToolbarActivity; +import com.mapswithme.util.statistics.Statistics; public class PlaceDescriptionActivity extends BaseToolbarActivity { @@ -15,10 +16,15 @@ public class PlaceDescriptionActivity extends BaseToolbarActivity return PlaceDescriptionFragment.class; } - public static void start(@NonNull Context context, @NonNull String description) + public static void start(@NonNull Context context, @NonNull String description, + @NonNull String source) { Intent intent = new Intent(context, PlaceDescriptionActivity.class) .putExtra(PlaceDescriptionFragment.EXTRA_DESCRIPTION, description); context.startActivity(intent); + Statistics.ParameterBuilder builder = new Statistics.ParameterBuilder() + .add(Statistics.EventParam.SOURCE, source); + Statistics.INSTANCE.trackEvent(Statistics.EventName.PLACEPAGE_DESCRIPTION_MORE, builder.get(), + Statistics.STATISTICS_CHANNEL_REALTIME); } } diff --git a/android/src/com/mapswithme/maps/gallery/impl/Factory.java b/android/src/com/mapswithme/maps/gallery/impl/Factory.java index db5ca34929..752ba187fb 100644 --- a/android/src/com/mapswithme/maps/gallery/impl/Factory.java +++ b/android/src/com/mapswithme/maps/gallery/impl/Factory.java @@ -3,20 +3,17 @@ package com.mapswithme.maps.gallery.impl; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.view.View; import com.mapswithme.maps.R; import com.mapswithme.maps.discovery.LocalExpert; import com.mapswithme.maps.gallery.Constants; import com.mapswithme.maps.gallery.GalleryAdapter; -import com.mapswithme.maps.gallery.Holders; 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.UiUtils; import com.mapswithme.util.statistics.GalleryPlacement; import com.mapswithme.util.statistics.GalleryState; import com.mapswithme.util.statistics.GalleryType; @@ -128,6 +125,6 @@ public class Factory if (products.length == 0) Statistics.INSTANCE.trackGalleryError(type, placement, Statistics.ParamValue.NO_PRODUCTS); else - Statistics.INSTANCE.trackGalleryShown(type, state, placement); + Statistics.INSTANCE.trackGalleryShown(type, state, placement, products.length); } } diff --git a/android/src/com/mapswithme/maps/promo/CatalogPromoController.java b/android/src/com/mapswithme/maps/promo/CatalogPromoController.java index e5c6284509..6f79041f00 100644 --- a/android/src/com/mapswithme/maps/promo/CatalogPromoController.java +++ b/android/src/com/mapswithme/maps/promo/CatalogPromoController.java @@ -28,7 +28,9 @@ import com.mapswithme.maps.widget.recycler.ItemDecoratorFactory; import com.mapswithme.util.NetworkPolicy; import com.mapswithme.util.UTM; import com.mapswithme.util.UiUtils; +import com.mapswithme.util.statistics.Destination; import com.mapswithme.util.statistics.GalleryPlacement; +import com.mapswithme.util.statistics.GalleryState; import com.mapswithme.util.statistics.GalleryType; import com.mapswithme.util.statistics.Statistics; @@ -44,6 +46,8 @@ public class CatalogPromoController implements Promo.Listener, Detachable BookmarksCatalogActivity.start(mPlacePageView.getContext(), - item.getUrl())); + cta.setOnClickListener(v -> onCtaClicked(placement, item.getUrl())); PromoCityGallery.Place place = item.getPlace(); @@ -220,12 +257,31 @@ public class CatalogPromoController implements Promo.Listener, Detachable PlaceDescriptionActivity.start(mPlacePageView.getContext(), - place.getDescription())); + place.getDescription(), + Statistics.ParamValue.MAPSME_GUIDES)); + + Statistics.INSTANCE.trackGalleryShown(GalleryType.PROMO, GalleryState.OFFLINE, + placement, 1); + } + + private void onCtaClicked(@NonNull GalleryPlacement placement, @NonNull String url) + { + BookmarksCatalogActivity.start(mPlacePageView.getContext(), url); + Statistics.INSTANCE.trackGalleryProductItemSelected(GalleryType.PROMO, placement, 0, + Destination.CATALOGUE); } } class GalleryPromoResponseHandler implements PromoResponseHandler { + @Sponsored.SponsoredType + private final int mSponsoredType; + + GalleryPromoResponseHandler(int sponsoredType) + { + mSponsoredType = sponsoredType; + } + @Override public void handleResponse(@NonNull PromoCityGallery promo) { @@ -236,17 +292,22 @@ public class CatalogPromoController implements Promo.Listener, Detachable