Mapsme 5283 1link statistics (#6823)

* [android] Added 1link statitistics for sponsored objects(viator/cian)

* [android] Added statistics for cian in search
This commit is contained in:
Aleksandr Zatsepin 2017-08-09 10:32:06 +03:00 committed by Arsentiy Milchakov
parent 49154d7ea7
commit dffd1bd899
4 changed files with 27 additions and 8 deletions

View file

@ -12,6 +12,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.widget.placepage.Sponsored;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.statistics.Statistics;
@ -50,9 +51,15 @@ class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolde
{
// TODO: remove this code after "cian" feature is obsoleted.
if (key.equals("cian"))
{
Statistics.INSTANCE.trackSponsoredEvent(Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SHOWN,
Sponsored.TYPE_CIAN);
mCategoryResIds[i] = R.string.real_estate;
}
else
{
throw new IllegalStateException("Can't get string resource id for category:" + key);
}
}
String iconId = "ic_category_" + key;

View file

@ -34,6 +34,7 @@ import com.mapswithme.maps.location.LocationListener;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.widget.PlaceholderView;
import com.mapswithme.maps.widget.SearchToolbarController;
import com.mapswithme.maps.widget.placepage.Sponsored;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.log.LoggerFactory;
@ -588,7 +589,11 @@ public class SearchFragment extends BaseMwmFragment
{
mToolbarController.setQuery(category);
if (!TextUtils.isEmpty(category) && category.equals("cian "))
{
Statistics.INSTANCE.trackSponsoredEvent(Statistics.EventName.SEARCH_SPONSOR_CATEGORY_SELECTED,
Sponsored.TYPE_CIAN);
showAllResultsOnMap();
}
}
private void updateFilterButton(boolean isHotel)

View file

@ -1018,14 +1018,16 @@ public class PlacePageView extends RelativeLayout
public void onItemSelected(@NonNull String url, @Sponsored.SponsoredType int type)
{
Utils.openUrl(getContext(), url);
Statistics.INSTANCE.trackSponsoredGalleryEvent(Statistics.EventName.PP_SPONSOR_ITEM_SELECTED,
type);
Statistics.INSTANCE.trackSponsoredEvent(Statistics.EventName.PP_SPONSOR_ITEM_SELECTED,
type);
}
@Override
public void onMoreItemSelected(@NonNull String url, @Sponsored.SponsoredType int type)
{
Utils.openUrl(getContext(), url);
Statistics.INSTANCE.trackSponsoredEvent(Statistics.EventName.PP_SPONSOR_MORE_SELECTED,
type);
}
@Override
@ -1985,8 +1987,8 @@ public class PlacePageView extends RelativeLayout
if (!TextUtils.isEmpty(url))
{
Utils.openUrl(getContext(), url);
Statistics.INSTANCE.trackSponsoredGalleryEvent(Statistics.EventName.PP_SPONSOR_LOGO_SELECTED,
mSponsored.getType());
Statistics.INSTANCE.trackSponsoredEvent(Statistics.EventName.PP_SPONSOR_LOGO_SELECTED,
mSponsored.getType());
}
break;
}

View file

@ -133,6 +133,8 @@ public enum Statistics
public static final String SEARCH_ON_MAP_CLICKED = "Search. View on map clicked.";
public static final String SEARCH_CANCEL = "Search. Cancel.";
public static final String SEARCH_TAB_SELECTED = "Search_Tab_selected";
public static final String SEARCH_SPONSOR_CATEGORY_SHOWN = "Search_SponsoredCategory_shown";
public static final String SEARCH_SPONSOR_CATEGORY_SELECTED = "Search_SponsoredCategory_selected";
// place page
public static final String PP_OPEN = "PP. Open";
@ -746,7 +748,9 @@ public enum Statistics
public void trackSponsoredGalleryShown(@Sponsored.SponsoredType int type)
{
trackEvent(PP_SPONSORED_SHOWN, Statistics.params().add(PROVIDER, convertToSponsor(type)).get());
String provider = convertToSponsor(type);
trackEvent(PP_SPONSORED_SHOWN, Statistics.params().add(PROVIDER, provider).get());
MyTracker.trackEvent(PP_SPONSORED_SHOWN + "_" + provider);
}
public void trackSponsoredGalleryError(@Sponsored.SponsoredType int type, String errorCode)
@ -755,10 +759,11 @@ public enum Statistics
.add(ERROR, errorCode).get());
}
public void trackSponsoredGalleryEvent(@NonNull String eventName,
@Sponsored.SponsoredType int type)
public void trackSponsoredEvent(@NonNull String eventName, @Sponsored.SponsoredType int type)
{
trackEvent(eventName, Statistics.params().add(PROVIDER, convertToSponsor(type)).get());
String provider = convertToSponsor(type);
trackEvent(eventName, Statistics.params().add(PROVIDER, provider).get());
MyTracker.trackEvent(eventName + "_" + provider);
}
@NonNull