diff --git a/iphone/Maps/Bookmarks/Catalog/BookmarksSubscriptionViewController.swift b/iphone/Maps/Bookmarks/Catalog/BookmarksSubscriptionViewController.swift index fa6d007f8b..65170314a1 100644 --- a/iphone/Maps/Bookmarks/Catalog/BookmarksSubscriptionViewController.swift +++ b/iphone/Maps/Bookmarks/Catalog/BookmarksSubscriptionViewController.swift @@ -17,6 +17,7 @@ import SafariServices @objc var onSubscribe: MWMVoidBlock? @objc var onCancel: MWMVoidBlock? + @objc var source: String = kStatWebView override var supportedInterfaceOrientations: UIInterfaceOrientationMask { get { return [.portrait] } @@ -71,7 +72,7 @@ import SafariServices Statistics.logEvent(kStatInappShow, withParameters: [kStatVendor: MWMPurchaseManager.bookmarksSubscriptionVendorId(), kStatPurchase: MWMPurchaseManager.bookmarksSubscriptionServerId(), kStatProduct: BOOKMARKS_SUBSCRIPTION_YEARLY_PRODUCT_ID, - kStatFrom: kStatBanner], with: .realtime) + kStatFrom: source], with: .realtime) InAppPurchase.bookmarksSubscriptionManager.getAvailableSubscriptions { [weak self] (subscriptions, error) in guard let subscriptions = subscriptions, subscriptions.count == 2 else { MWMAlertViewController.activeAlert().presentInfoAlert(L("price_error_title"), diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 37fe2383fa..e4c1878e81 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -71,6 +71,7 @@ extern NSString * const kAlohalyticsTapEventKey; [NSLayoutConstraint activateConstraints: @[[self.crownButton.leftAnchor constraintEqualToAnchor:self.trafficButton.view.leftAnchor constant:-4], [self.crownButton.topAnchor constraintEqualToAnchor:self.sideButtons.view.topAnchor]]]; + [Statistics logEvent:kStatMapCrownButtonShow withParameters:@{kStatTarget : kStatGuidesSubscription}]; } return self; } @@ -304,6 +305,7 @@ extern NSString * const kAlohalyticsTapEventKey; } - (void)onCrown:(UIButton *)sender { + [Statistics logEvent:kStatMapCrownButtonClick withParameters:@{kStatTarget : kStatGuidesSubscription}]; BookmarksSubscriptionViewController *controller = [[BookmarksSubscriptionViewController alloc] init]; controller.onSubscribe = ^{ MapViewController *mapViewController = self.ownerController; @@ -322,6 +324,8 @@ extern NSString * const kAlohalyticsTapEventKey; [self.ownerController dismissViewControllerAnimated:YES completion:nil]; }; + controller.source = kStatSponsoredButton; + [self.ownerController presentViewController:controller animated:YES completion:^{ self.crownButton.hidden = YES; }]; diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index d932c8ba5f..f7d89b9be4 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -203,6 +203,7 @@ static NSString * const kStatGuestHouse = @"guestHouse"; static NSString * const kStatGuidesBookmarkSelect = @"Bookmarks_BookmarksList_Bookmark_select"; static NSString * const kStatGuidesShown = @"Bookmarks_Downloaded_Guides_list"; static NSString * const kStatGuidesOpen = @"Bookmarks_Downloaded_Guide_open"; +static NSString * const kStatGuidesSubscription = @"GuidesSubscription"; static NSString * const kStatGuidesTrackSelect = @"Bookmarks_BookmarksList_Track_select"; static NSString * const kStatHasAuthorization = @"has_auth"; static NSString * const kStatHelp = @"Help"; @@ -246,6 +247,8 @@ static NSString * const kStatLocation = @"Location"; static NSString * const kStatLogout = @"Logout"; static NSString * const kStatMakeInvisibleOnMap = @"make_invisible_on_map"; static NSString * const kStatMap = @"map"; +static NSString * const kStatMapCrownButtonShow = @"Map_SponsoredButton_show"; +static NSString * const kStatMapCrownButtonClick = @"Map_SponsoredButton_click"; static NSString * const kStatMapDataSize = @"map_data_size"; static NSString * const kStatMapSearch = @"Map search"; static NSString * const kStatMapViewStyle = @"Map view style"; @@ -310,6 +313,8 @@ static NSString * const kStatOverview = @"overview"; static NSString * const kStatPedestrian = @"Pedestrian"; static NSString * const kStatPhone = @"Phone"; static NSString * const kStatPlacePage = @"placepage"; +static NSString * const kStatPlacePageToponims = @"placepage_large_toponyms"; +static NSString * const kStatPlacePageSightSeeing = @"placepage_sightseeings"; static NSString * const kStatPlacePageBannerBlank = @"Placepage_Banner_blank"; static NSString * const kStatPlacePageBannerClick = @"Placepage_Banner_click"; static NSString * const kStatPlacePageBannerError = @"Placepage_Banner_error"; @@ -441,6 +446,7 @@ static NSString * const kStatSimplifiedColors = @"Simplified colors scheme"; static NSString * const kStatSocial = @"Social"; static NSString * const kStatSource = @"Source"; static NSString * const kStatSponsor = @"sponsor"; +static NSString * const kStatSponsoredButton = @"sponsored_button"; static NSString * const kStatStart = @"Start"; static NSString * const kStatState = @"state"; static NSString * const kStatSwapRoutingPoints = @"Swap routing points"; @@ -449,6 +455,7 @@ static NSString * const kStatTTSSettings = @"TTS settings"; static NSString * const kStatTab = @"tab"; static NSString * const kStatTable = @"Table"; static NSString * const kStatTags = @"tags"; +static NSString * const kStatTarget = @"target"; static NSString * const kStatTaxi = @"Taxi"; static NSString * const kStatThingsToDo = @"Things to do"; static NSString * const kStatTipsTricksClick = @"TipsTricks_click"; @@ -501,6 +508,7 @@ static NSString * const kStatVendor = @"vendor"; static NSString * const kStatVezet = @"Vezet"; static NSString * const kStatViewOnMap = @"view_on_map"; static NSString * const kStatVisible = @"Visible"; +static NSString * const kStatWebView = @"webview"; static NSString * const kStatWhatsNew = @"What's New"; static NSString * const kStatWifi = @"wifi"; static NSString * const kStatYandex = @"Yandex"; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index 53e456e160..b18d3fab91 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -269,6 +269,8 @@ using NewSectionsAreReady = void (^)(NSRange const & range, MWMPlacePageData * d - (BOOL)isPartner; - (BOOL)isHolidayObject; - (BOOL)isPromoCatalog; +- (BOOL)isLargeToponim; +- (BOOL)isSightseeing; - (BOOL)isBookingSearch; - (BOOL)isHTMLDescription; - (BOOL)isMyPosition; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 0c24a980ab..5c0f591cf0 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -826,8 +826,9 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; - (BOOL)isOpentable { return m_info.GetSponsoredType() == SponsoredType::Opentable; } - (BOOL)isPartner { return m_info.GetSponsoredType() == SponsoredType::Partner; } - (BOOL)isHolidayObject { return m_info.GetSponsoredType() == SponsoredType::Holiday; } -- (BOOL)isPromoCatalog { return m_info.GetSponsoredType() == SponsoredType::PromoCatalogCity - || m_info.GetSponsoredType() == SponsoredType::PromoCatalogSightseeings; } +- (BOOL)isPromoCatalog { return self.isLargeToponim || self.isSightseeing; } +- (BOOL)isLargeToponim { return m_info.GetSponsoredType() == SponsoredType::PromoCatalogCity; } +- (BOOL)isSightseeing { return m_info.GetSponsoredType() == SponsoredType::PromoCatalogSightseeings; } - (BOOL)isBookingSearch { return !m_info.GetBookingSearchUrl().empty(); } - (BOOL)isMyPosition { return m_info.IsMyPosition(); } - (BOOL)isHTMLDescription { return strings::IsHTML(GetPreferredBookmarkStr(m_info.GetBookmarkData().m_description)); } @@ -907,8 +908,9 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; [Statistics logEvent:kStatPlacepageSponsoredShow withParameters:@{ kStatProvider: kStatMapsmeGuides, - kStatPlacement: kStatPlacePage, - kStatState: kStatOnline + kStatPlacement: self.isLargeToponim ? kStatPlacePageToponims : kStatPlacePageSightSeeing, + kStatState: kStatOnline, + kStatCount: @(cityGallery.m_items.size()) }]; if (self.refreshPromoCallback) { self.refreshPromoCallback(); @@ -920,7 +922,7 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS"; [Statistics logEvent:kStatPlacepageSponsoredError withParameters:@{ kStatProvider: kStatMapsmeGuides, - kStatPlacement: kStatPlacePage, + kStatPlacement: self.isLargeToponim ? kStatPlacePageToponims : kStatPlacePageSightSeeing, kStatError: kStatDownloadError }]; if (self.refreshPromoCallback) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift index 410f697d4e..2b69c0fe47 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/CatalogPromo/CatalogSingleItemCell.swift @@ -29,7 +29,7 @@ } @IBAction func onMoreButton(_ sender: UIButton) { - onView?() + onMore?() } @IBAction func onCatalogButton(_ sender: UIButton) { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm index 7434275b1a..867579b02d 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMPlacePageLayout.mm @@ -646,15 +646,32 @@ std::map const kMetaInfoCells = { [tableView dequeueReusableCellWithCellClass:CatalogSingleItemCell.class indexPath:indexPath]; CatalogPromoItem *item = [[CatalogPromoItem alloc] initWithCoreItem:[data.promoGallery galleryItemAtIndex:0]]; [cell config:item]; - cell.onMore = ^{ - [tableView beginUpdates]; - [tableView endUpdates]; - }; __weak __typeof(self) ws = self; + cell.onMore = ^{ + __strong __typeof(self) self = ws; + [Statistics logEvent:kStatPlacepageSponsoredItemSelected + withParameters:@{ + kStatProvider: kStatMapsmeGuides, + kStatPlacement: kStatPlacePageSightSeeing, + kStatItem: @(0), + kStatDestination: kStatCatalogue + }]; + NSURL *url = [NSURL URLWithString:item.catalogUrl]; + NSURL *patchedUrl = [[MWMBookmarksManager sharedManager] injectCatalogUTMContent:url content:MWMUTMContentMore]; + [self.delegate openCatalogForURL:patchedUrl]; + }; cell.onView = ^{ __strong __typeof(self) self = ws; + [Statistics logEvent:kStatPlacepageSponsoredItemSelected + withParameters:@{ + kStatProvider: kStatMapsmeGuides, + kStatPlacement: kStatPlacePageSightSeeing, + kStatItem: @(0), + kStatDestination: kStatCatalogue + }]; NSURL *url = [NSURL URLWithString:item.catalogUrl]; - [self.delegate openCatalogForURL:url]; + NSURL *patchedUrl = [[MWMBookmarksManager sharedManager] injectCatalogUTMContent:url content:MWMUTMContentView]; + [self.delegate openCatalogForURL:patchedUrl]; }; return cell; } else { @@ -901,7 +918,7 @@ std::map const kMetaInfoCells = { [Statistics logEvent:kStatPlacepageSponsoredMoreSelected withParameters:@{ kStatProvider: kStatMapsmeGuides, - kStatPlacement: kStatPlacePage + kStatPlacement: self.data.isLargeToponim ? kStatPlacePageToponims : kStatPlacePageSightSeeing, }]; } else { promo::CityGallery::Item const &item = [self.data.promoGallery galleryItemAtIndex:indexPath.row]; @@ -914,7 +931,7 @@ std::map const kMetaInfoCells = { [Statistics logEvent:kStatPlacepageSponsoredItemSelected withParameters:@{ kStatProvider: kStatMapsmeGuides, - kStatPlacement: kStatPlacePage, + kStatPlacement: self.data.isLargeToponim ? kStatPlacePageToponims : kStatPlacePageSightSeeing, kStatItem: @(indexPath.item + 1), kStatDestination: kStatCatalogue }];