Added new UTM

This commit is contained in:
r.kuznetsov 2019-09-11 17:29:49 +03:00 committed by Aleksey Belousov
parent 36f9e88c98
commit 267d4544f5
15 changed files with 61 additions and 36 deletions

View file

@ -1280,8 +1280,9 @@ public class PlacePageView extends NestedScrollView
if (hasPromoGallery && policy.canUseNetwork())
{
mCatalogPromoRecycler.setAdapter(mCatalogPromoLoadingAdapter);
// TODO: set correct UTM
Promo.INSTANCE.nativeRequestCityGallery(policy, mMapObject.getLat(), mMapObject.getLon(),
UTM.UTM_PLACEPAGE_GALLERY);
UTM.UTM_LARGE_TOPONYMS_PLACEPAGE_GALLERY);
}
else if (hasPromoGallery)
{
@ -1296,8 +1297,9 @@ public class PlacePageView extends NestedScrollView
{
if (policy.canUseNetwork())
{
// TODO: set correct UTM
Promo.INSTANCE.nativeRequestCityGallery(policy, mapObject.getLat(), mapObject.getLon(),
UTM.UTM_PLACEPAGE_GALLERY);
UTM.UTM_LARGE_TOPONYMS_PLACEPAGE_GALLERY);
mCatalogPromoRecycler.setAdapter(Factory.createCatalogPromoLoadingAdapter());
}
}

View file

@ -29,11 +29,11 @@ public final class Sponsored
public static final int TYPE_PARTNER = 3;
public static final int TYPE_HOLIDAY = 4;
public static final int TYPE_PROMO_CATALOG_CITY = 5;
public static final int TYPE_PROMO_CATALOG_POI = 6;
public static final int TYPE_PROMO_CATALOG_SIGHTSEEINGS = 6;
@Retention(RetentionPolicy.SOURCE)
@IntDef({ TYPE_NONE, TYPE_BOOKING, TYPE_OPENTABLE, TYPE_PARTNER, TYPE_HOLIDAY,
TYPE_PROMO_CATALOG_CITY, TYPE_PROMO_CATALOG_POI })
TYPE_PROMO_CATALOG_CITY, TYPE_PROMO_CATALOG_SIGHTSEEINGS })
public @interface SponsoredType {}
static class FacilityType

View file

@ -8,8 +8,9 @@ public class UTM
{
@Retention(RetentionPolicy.SOURCE)
@IntDef({ UTM_NONE, UTM_BOOKMARKS_PAGE_CATALOG_BUTTON, UTM_TOOLBAR_BUTTON,
UTM_DOWNLOAD_MWM_BANNER, UTM_PLACEPAGE_GALLERY, UTM_DISCOVERY_PAGE_GALLERY,
UTM_TIPS_AND_TRICKS, UTM_BOOKING_PROMO })
UTM_DOWNLOAD_MWM_BANNER, UTM_LARGE_TOPONYMS_PLACEPAGE_GALLERY,
UTM_SIGHTSEEINGS_PLACEPAGE_GALLERY, UTM_DISCOVERY_PAGE_GALLERY,
UTM_TIPS_AND_TRICKS, UTM_BOOKING_PROMO, UTM_CROWN_BUTTON })
public @interface UTMType {}
// The order of these constants must correspond to C++ enumeration in partners_api/utm.hpp.
@ -17,8 +18,10 @@ public class UTM
public static final int UTM_BOOKMARKS_PAGE_CATALOG_BUTTON = 1;
public static final int UTM_TOOLBAR_BUTTON = 2;
public static final int UTM_DOWNLOAD_MWM_BANNER = 3;
public static final int UTM_PLACEPAGE_GALLERY = 4;
public static final int UTM_DISCOVERY_PAGE_GALLERY = 5;
public static final int UTM_TIPS_AND_TRICKS = 6;
public static final int UTM_BOOKING_PROMO = 7;
public static final int UTM_LARGE_TOPONYMS_PLACEPAGE_GALLERY = 4;
public static final int UTM_SIGHTSEEINGS_PLACEPAGE_GALLERY = 5;
public static final int UTM_DISCOVERY_PAGE_GALLERY = 6;
public static final int UTM_TIPS_AND_TRICKS = 7;
public static final int UTM_BOOKING_PROMO = 8;
public static final int UTM_CROWN_BUTTON = 9;
}

View file

@ -1,6 +1,6 @@
package com.mapswithme.util.statistics;
public enum GalleryPlacement
public enum GalleryPlacement
{
PLACEPAGE,
DISCOVERY;

View file

@ -1287,8 +1287,8 @@ public enum Statistics
return PARTNER;
case Sponsored.TYPE_PROMO_CATALOG_CITY:
return MAPSME_GUIDES;
case Sponsored.TYPE_PROMO_CATALOG_POI:
// Dummy, fix with correct value when documentation will be done.
case Sponsored.TYPE_PROMO_CATALOG_SIGHTSEEINGS:
// TODO: Dummy, fix with correct value when documentation will be done.
return MAPSME_GUIDES;
case Sponsored.TYPE_NONE:
return "N/A";

View file

@ -4,8 +4,10 @@ typedef NS_ENUM(NSInteger, MWMUTM) {
MWMUTMBookmarksPageCatalogButton,
MWMUTMToolbarButton,
MWMUTMDownloadMwmBanner,
MWMUTMPlacepageGallery,
MWMUTMLargeToponymsPlacepageGallery,
MWMUTMSightseeingsPlacepageGallery,
MWMUTMDiscoveryPageGallery,
MWMUTMTipsAndTricks,
MWMUTMBookingPromo
MWMUTMBookingPromo,
MWMUTMCrownButton,
};

View file

@ -306,7 +306,7 @@ extern NSString * const kAlohalyticsTapEventKey;
BookmarksSubscriptionGoToCatalogViewController *successDialog =
[[BookmarksSubscriptionGoToCatalogViewController alloc] initOnOk:^{
[mapViewController dismissViewControllerAnimated:YES completion:nil];
[mapViewController openCatalogAnimated:YES utm:MWMUTMNone];
[mapViewController openCatalogAnimated:YES utm:MWMUTMCrownButton];
} onCancel:^{
[mapViewController dismissViewControllerAnimated:YES completion:nil];
}];
@ -500,7 +500,7 @@ extern NSString * const kAlohalyticsTapEventKey;
MWMVoidBlock ok = ^{
auto urlString = afterBooking.promoUrl;
auto url = [NSURL URLWithString:urlString];
[MapViewController.sharedController openCatalogAbsoluteUrl:url animated:YES utm:MWMUTMNone];
[MapViewController.sharedController openCatalogAbsoluteUrl:url animated:YES utm:MWMUTMBookingPromo];
[self.ownerController dismissViewControllerAnimated:YES completion:nil];
};

View file

@ -933,7 +933,8 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
};
auto appInfo = AppInfo.sharedInfo;
auto locale = appInfo.twoLetterLanguageId.UTF8String;
api->GetCityGallery(self.mercator, locale, UTM::PlacepageGallery, resultHandler, errorHandler);
//TODO: set correct UTM
api->GetCityGallery(self.mercator, locale, UTM::LargeToponymsPlacepageGallery, resultHandler, errorHandler);
}
if (self.refreshPromoCallback) {

View file

@ -999,12 +999,12 @@ void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & inf
: place_page::OpeningMode::PreviewPlus);
info.SetSponsoredType(SponsoredType::PromoCatalogCity);
}
else if (ftypes::IsPromoCatalogPoiChecker::Instance()(ft))
else if (ftypes::IsPromoCatalogSightseeingsChecker::Instance()(ft))
{
info.SetOpeningMode(m_routingManager.IsRoutingActive() || !GetPlatform().IsConnected()
? place_page::OpeningMode::Preview
: place_page::OpeningMode::PreviewPlus);
info.SetSponsoredType(SponsoredType::PromoCatalogPoi);
info.SetSponsoredType(SponsoredType::PromoCatalogSightseeings);
}
FillLocalExperts(ft, info);

View file

@ -46,7 +46,7 @@ enum class SponsoredType
Partner,
Holiday,
PromoCatalogCity,
PromoCatalogPoi,
PromoCatalogSightseeings,
};
enum class LocalAdsStatus

View file

@ -10,17 +10,24 @@ namespace ftypes
{
class IsPromoCatalogPoiChecker : public BaseChecker
{
public:
DECLARE_CHECKER_INSTANCE(IsPromoCatalogPoiChecker);
private:
IsPromoCatalogPoiChecker()
protected:
IsPromoCatalogPoiChecker(promo::TypesList const & types)
{
auto const & types = promo::GetPromoCatalogPoiTypes();
for (auto const & type : types)
{
m_types.push_back(classif().GetTypeByPath(type));
}
}
};
class IsPromoCatalogSightseeingsChecker : public IsPromoCatalogPoiChecker
{
public:
DECLARE_CHECKER_INSTANCE(IsPromoCatalogSightseeingsChecker);
private:
IsPromoCatalogSightseeingsChecker()
: IsPromoCatalogPoiChecker(promo::GetPromoCatalogSightseeingsTypes())
{}
};
} // namespace ftypes

View file

@ -23,7 +23,7 @@ Container::Container()
{"tourism", "resort"},
{"sponsored", "promo_catalog"}});
m_excludedTypes.Append(promo::GetPromoCatalogPoiTypes());
m_excludedTypes.Append(promo::GetPromoCatalogSightseeingsTypes());
}
void Container::AppendEntry(std::initializer_list<std::initializer_list<char const *>> && types,

View file

@ -2,7 +2,7 @@
namespace
{
promo::TypesList kTypes = {
promo::TypesList kSightseeingsTypes = {
{"tourism", "gallery"},
{"tourism", "museum"},
{"amenity", "arts_centre"},
@ -26,8 +26,8 @@ promo::TypesList kTypes = {
namespace promo
{
TypesList const & GetPromoCatalogPoiTypes()
TypesList const & GetPromoCatalogSightseeingsTypes()
{
return kTypes;
return kSightseeingsTypes;
}
} // namespace promo

View file

@ -5,5 +5,5 @@
namespace promo
{
using TypesList = std::initializer_list<std::initializer_list<char const *>>;
TypesList const & GetPromoCatalogPoiTypes();
TypesList const & GetPromoCatalogSightseeingsTypes();
} // namespace promo

View file

@ -11,10 +11,12 @@ enum class UTM : uint8_t
BookmarksPageCatalogButton,
ToolbarButton,
DownloadMwmBanner,
PlacepageGallery,
LargeToponymsPlacepageGallery,
SightseeingsPlacepageGallery,
DiscoveryPageGallery,
TipsAndTricks,
BookingPromo
BookingPromo,
CrownButton,
};
inline std::string InjectUTM(std::string const & url, UTM utm)
@ -35,9 +37,13 @@ inline std::string InjectUTM(std::string const & url, UTM utm)
params.emplace_back("utm_medium", "banner");
params.emplace_back("utm_campaign", "download_map_popup");
break;
case UTM::PlacepageGallery:
case UTM::LargeToponymsPlacepageGallery:
params.emplace_back("utm_medium", "gallery");
params.emplace_back("utm_campaign", "placepage_gallery");
params.emplace_back("utm_campaign", "large_toponyms_placepage_gallery");
break;
case UTM::SightseeingsPlacepageGallery:
params.emplace_back("utm_medium", "gallery");
params.emplace_back("utm_campaign", "sightseeings_placepage_gallery");
break;
case UTM::DiscoveryPageGallery:
params.emplace_back("utm_medium", "gallery");
@ -51,6 +57,10 @@ inline std::string InjectUTM(std::string const & url, UTM utm)
params.emplace_back("utm_medium", "popup");
params.emplace_back("utm_campaign", "bookingcom");
break;
case UTM::CrownButton:
params.emplace_back("utm_medium", "button");
params.emplace_back("utm_campaign", "map_sponsored_button");
break;
case UTM::None:
return url;
}