forked from organicmaps/organicmaps-tmp
[MAPSME-5284] [ios] Added Cian statistics.
This commit is contained in:
parent
13f8467457
commit
63c4bfdb59
5 changed files with 50 additions and 14 deletions
|
@ -41,6 +41,7 @@ static NSString * const kStatChangeNightMode = @"Change night mode";
|
|||
static NSString * const kStatChangeRecentTrack = @"Change recent track";
|
||||
static NSString * const kStatChangeRoutingMode = @"Change routing mode";
|
||||
static NSString * const kStatCharging = @"charging";
|
||||
static NSString * const kStatCian = @"Cian.ru";
|
||||
static NSString * const kStatClear = @"Clear";
|
||||
static NSString * const kStatClose = @"Close";
|
||||
static NSString * const kStatCollapse = @"Collapse";
|
||||
|
@ -183,11 +184,15 @@ static NSString * const kStatPlacePageNonBuilding = @"placepage_nonbuilding";
|
|||
static NSString * const kStatPlacePageOwnershipButtonClick = @"Placepage_OwnershipButton_click";
|
||||
static NSString * const kStatPlacePageRestaurantBook = @"Placepage_Restaurant_book";
|
||||
static NSString * const kStatPlacePageTaxiClick = @"Placepage_Taxi_click";
|
||||
static NSString * const kStatPlacepageSponsoredError = @"Placepage_sponsored_error";
|
||||
static NSString * const kStatPlacepageSponsoredItemSelected = @"Placepage_Viator_item_selected";
|
||||
static NSString * const kStatPlacepageSponsoredMoreSelected = @"Placepage_Viator_more_selected";
|
||||
static NSString * const kStatPlacepageSponsoredOpen = @"Placepage_sponsored_open";
|
||||
static NSString * const kStatPlacepageSponsoredShow = @"Placepage_sponsored_shown";
|
||||
static NSString * const kStatPlacepageSponsoredError = @"Placepage_SponsoredGallery_error";
|
||||
static NSString * const kStatPlacepageSponsoredItemSelected =
|
||||
@"Placepage_SponsoredGallery_ProductItem_selected";
|
||||
static NSString * const kStatPlacepageSponsoredLogoSelected =
|
||||
@"Placepage_SponsoredGallery_LogoItem_selected";
|
||||
static NSString * const kStatPlacepageSponsoredMoreSelected =
|
||||
@"Placepage_SponsoredGallery_MoreItem_selected";
|
||||
static NSString * const kStatPlacepageSponsoredOpen = @"Placepage_SponsoredGalleryPage_opened";
|
||||
static NSString * const kStatPlacepageSponsoredShow = @"Placepage_SponsoredGallery_shown";
|
||||
static NSString * const kStatPlacepageTaxiShow = @"Placepage_Taxi_show";
|
||||
static NSString * const kStatPointToPoint = @"Point to point";
|
||||
static NSString * const kStatPortrait = @"Portrait";
|
||||
|
|
|
@ -253,9 +253,11 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
|
|||
return;
|
||||
NSMutableDictionary * parameters = [@{} mutableCopy];
|
||||
if (data.isViator)
|
||||
parameters[kStatSponsor] = kStatViator;
|
||||
parameters[kStatProvider] = kStatViator;
|
||||
else if (data.isBooking)
|
||||
parameters[kStatSponsor] = kStatBooking;
|
||||
parameters[kStatProvider] = kStatBooking;
|
||||
else if (data.isCian)
|
||||
parameters[kStatProvider] = kStatCian;
|
||||
switch (Platform::ConnectionStatus())
|
||||
{
|
||||
case Platform::EConnectionType::CONNECTION_NONE:
|
||||
|
@ -264,6 +266,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
|
|||
case Platform::EConnectionType::CONNECTION_WIFI: parameters[kStatConnection] = kStatWifi; break;
|
||||
case Platform::EConnectionType::CONNECTION_WWAN: parameters[kStatConnection] = kStatMobile; break;
|
||||
}
|
||||
parameters[kStatTags] = data.statisticsTags;
|
||||
[Statistics logEvent:kStatPlacepageSponsoredOpen withParameters:parameters];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import MyTrackerSDK
|
||||
|
||||
@objc(MWMPPCianCarouselCell)
|
||||
final class PPCianCarouselCell: MWMTableViewCell {
|
||||
@IBOutlet private weak var title: UILabel! {
|
||||
|
@ -26,6 +28,8 @@ final class PPCianCarouselCell: MWMTableViewCell {
|
|||
fileprivate let kMaximumNumberOfElements = 5
|
||||
fileprivate var delegate: MWMPlacePageButtonsProtocol?
|
||||
|
||||
fileprivate var statisticsParameters: [AnyHashable: Any] { return [kStatProvider : kStatCian] }
|
||||
|
||||
func config(delegate d: MWMPlacePageButtonsProtocol?) {
|
||||
delegate = d
|
||||
collectionView.contentOffset = .zero
|
||||
|
@ -68,6 +72,8 @@ final class PPCianCarouselCell: MWMTableViewCell {
|
|||
|
||||
@IBAction
|
||||
fileprivate func onMore() {
|
||||
MRMyTracker.trackEvent(withName: "Placepage_SponsoredGallery_LogoItem_selected_Cian.Ru")
|
||||
Statistics.logEvent(kStatPlacepageSponsoredLogoSelected, withParameters: statisticsParameters)
|
||||
delegate?.openSponsoredURL(nil)
|
||||
}
|
||||
}
|
||||
|
@ -78,16 +84,28 @@ extension PPCianCarouselCell: UICollectionViewDelegate, UICollectionViewDataSour
|
|||
indexPath: indexPath) as! CianElement
|
||||
if let data = data {
|
||||
if data.isEmpty {
|
||||
cell.state = .error(onButtonAction: onMore)
|
||||
cell.state = .error(onButtonAction: { [unowned self] in
|
||||
Statistics.logEvent(kStatPlacepageSponsoredError, withParameters: self.statisticsParameters)
|
||||
self.delegate?.openSponsoredURL(nil)
|
||||
})
|
||||
} else {
|
||||
let model = isLastCell(indexPath) ? nil : data[indexPath.item]
|
||||
cell.state = .offer(model: model,
|
||||
onButtonAction: { [unowned self] model in
|
||||
let isMore = model == nil
|
||||
MRMyTracker.trackEvent(withName: isMore ? "Placepage_SponsoredGallery_MoreItem_selected_Cian.Ru" :
|
||||
"Placepage_SponsoredGallery_ProductItem_selected_Cian.Ru")
|
||||
Statistics.logEvent(isMore ? kStatPlacepageSponsoredMoreSelected : kStatPlacepageSponsoredItemSelected,
|
||||
withParameters: self.statisticsParameters)
|
||||
self.delegate?.openSponsoredURL(model?.pageURL)
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
cell.state = .pending(onButtonAction: onMore)
|
||||
cell.state = .pending(onButtonAction: { [unowned self] in
|
||||
MRMyTracker.trackEvent(withName: "Placepage_SponsoredGallery_MoreItem_selected_Cian.Ru")
|
||||
Statistics.logEvent(kStatPlacepageSponsoredMoreSelected, withParameters: self.statisticsParameters)
|
||||
self.delegate?.openSponsoredURL(nil)
|
||||
})
|
||||
}
|
||||
return cell
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@ final class PPViatorCarouselCell: MWMTableViewCell {
|
|||
fileprivate let kMaximumNumberOfElements = 5
|
||||
fileprivate var delegate: MWMPlacePageButtonsProtocol?
|
||||
|
||||
fileprivate var statisticsParameters: [AnyHashable: Any] { return [kStatProvider : kStatViator] }
|
||||
|
||||
func config(with ds: [ViatorItemModel], delegate d: MWMPlacePageButtonsProtocol?) {
|
||||
if ds.isEmpty {
|
||||
Statistics.logEvent(kStatPlacepageSponsoredError)
|
||||
Statistics.logEvent(kStatPlacepageSponsoredError, withParameters: statisticsParameters)
|
||||
}
|
||||
dataSource = ds
|
||||
delegate = d
|
||||
|
@ -42,6 +44,7 @@ final class PPViatorCarouselCell: MWMTableViewCell {
|
|||
|
||||
@IBAction
|
||||
func onMore() {
|
||||
Statistics.logEvent(kStatPlacepageSponsoredLogoSelected, withParameters: statisticsParameters)
|
||||
delegate?.openSponsoredURL(nil)
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +68,6 @@ extension PPViatorCarouselCell: UICollectionViewDelegate, UICollectionViewDataSo
|
|||
let isMore = isLastCell(indexPath)
|
||||
let url: URL? = isMore ? nil : dataSource[indexPath.item].pageURL
|
||||
delegate?.openSponsoredURL(url)
|
||||
Statistics.logEvent(isMore ? kStatPlacepageSponsoredMoreSelected : kStatPlacepageSponsoredItemSelected)
|
||||
Statistics.logEvent(isMore ? kStatPlacepageSponsoredMoreSelected : kStatPlacepageSponsoredItemSelected, withParameters: statisticsParameters)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import "MWMPlacePageLayout.h"
|
||||
#import <MyTrackerSDK/MRMyTracker.h>
|
||||
#import "MWMBookmarkCell.h"
|
||||
#import "MWMCircularProgress.h"
|
||||
#import "MWMUGCCommentCell.h"
|
||||
#import "MWMOpeningHoursLayoutHelper.h"
|
||||
#import "MWMPPPreviewLayoutHelper.h"
|
||||
#import "MWMPPReviewCell.h"
|
||||
|
@ -10,6 +10,7 @@
|
|||
#import "MWMPlacePageData.h"
|
||||
#import "MWMPlacePageLayoutImpl.h"
|
||||
#import "MWMPlacePageRegularCell.h"
|
||||
#import "MWMUGCCommentCell.h"
|
||||
#import "MWMiPadPlacePageLayoutImpl.h"
|
||||
#import "MWMiPhonePlacePageLayoutImpl.h"
|
||||
#import "MapViewController.h"
|
||||
|
@ -585,7 +586,13 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
NSAssert(NO, @"Viator is shown but items are empty.");
|
||||
return;
|
||||
}
|
||||
[Statistics logEvent:kStatPlacepageSponsoredShow];
|
||||
[Statistics logEvent:kStatPlacepageSponsoredShow withParameters:@{kStatProvider : kStatViator}];
|
||||
});
|
||||
|
||||
checkCell(self.cianCell, ^{
|
||||
self.cianCell = nil;
|
||||
[MRMyTracker trackEventWithName:@"Placepage_SponsoredGallery_shown_Cian.Ru"];
|
||||
[Statistics logEvent:kStatPlacepageSponsoredShow withParameters:@{kStatProvider : kStatCian}];
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue