[iOS] Statistics for onboarding

https://jira.mail.ru/browse/MAPSME-12295
This commit is contained in:
Alexander Boriskov 2019-11-19 17:52:45 +03:00 committed by Arsentiy Milchakov
parent 3ae4d5d4a5
commit 2b0a743397
14 changed files with 39 additions and 50 deletions

View file

@ -70,6 +70,7 @@ NSString * const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
[NSLayoutConstraint activateConstraints:
@[[self.promoButton.centerXAnchor constraintEqualToAnchor:self.trafficButton.view.centerXAnchor],
[self.promoButton.topAnchor constraintEqualToAnchor:self.sideButtons.view.topAnchor]]];
[Statistics logEvent:kStatMapSponsoredButtonShow withParameters:@{kStatTarget : kStatGuidesSubscription}];
}
return self;
}

View file

@ -17,6 +17,7 @@ import UIKit
func onPromoButtonPress(completion: @escaping () -> Void) {
presentPromoDiscoveryOnboarding(completion: completion)
Statistics.logEvent(kStatMapSponsoredButtonClick, withParameters: [kStatTarget: kStatGuidesSubscription])
}
private func presentPromoDiscoveryOnboarding(completion: @escaping () -> Void) {

View file

@ -20,6 +20,7 @@ static NSString * const kStatAddDescription = @"add_description";
static NSString * const kStatAddPlace = @"add_place";
static NSString * const kStatAfterSave = @"after_save";
static NSString * const kStatAppsflyer = @"appsflyer";
static NSString * const kStatAgreement = @"agreement";
static NSString * const kStatAlert = @"Alert";
static NSString * const kStatAllMaps = @"all_maps";
static NSString * const kStatAlways = @"Always";
@ -202,7 +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 kStatGuidesSubscription = @"OnboardingGuidesSubscription";
static NSString * const kStatGuidesTrackSelect = @"Bookmarks_BookmarksList_Track_select";
static NSString * const kStatHasAuthorization = @"has_auth";
static NSString * const kStatHelp = @"Help";
@ -247,6 +248,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 kStatMapSponsoredButtonShow = @"Map_SponsoredButton_show";
static NSString * const kStatMapSponsoredButtonClick = @"Map_SponsoredButton_click";
static NSString * const kStatMapDataSize = @"map_data_size";
static NSString * const kStatMapSearch = @"Map search";
static NSString * const kStatMapViewStyle = @"Map view style";
@ -299,6 +302,15 @@ static NSString * const kStatOn = @"On";
static NSString * const kStatOnboardingDlShow= @"OnboardingDeeplinkScreen_show";
static NSString * const kStatOnboardingDlAccept = @"OnboardingDeeplinkScreen_accept";
static NSString * const kStatOnboardingGuidesSubscription = @"onboarding_guides_subscription";
static NSString * const kStatOnboardingScreenShow = @"OnboardingScreen_show";
static NSString * const kStatOnboardingScreenAccept = @"OnboardingScreen_accept";
static NSString * const kStatOnboardingScreenDecline = @"OnboardingScreen_decline";
static NSString * const kStatOnboardingDream = @"dream_and_plan";
static NSString * const kStatOnboardingExperience = @"experience";
static NSString * const kStatOnboardingShare = @"share_emotions";
static NSString * const kStatOnboardingCatalog = @"catalog_discovery";
static NSString * const kStatOnboardingSubscription = @"buy_subscription";
static NSString * const kStatOnboardingSample = @"sample_discovery";
static NSString * const kStatOnline = @"online";
static NSString * const kStatOpen = @"Open";
static NSString * const kStatOpenActionSheet = @"Open action sheet";
@ -505,11 +517,12 @@ static NSString * const kStatUserInterrupted = @"user_interrupted";
static NSString * const kStatValue = @"Value";
static NSString * const kStatVehicle = @"Vehicle";
static NSString * const kStatVendor = @"vendor";
static NSString * const kStatVersion = @"version";
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 kStatWhatsNew = @"WhatsNew_action";
static NSString * const kStatWifi = @"wifi";
static NSString * const kStatWikipedia = @"wikipedia";
static NSString * const kStatYandex = @"Yandex";

View file

@ -599,7 +599,6 @@
995739042355CAA30019AEE7 /* PageIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995739032355CAA30019AEE7 /* PageIndicator.swift */; };
995739062355CAC40019AEE7 /* ImageViewCrossDisolve.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995739052355CAC40019AEE7 /* ImageViewCrossDisolve.swift */; };
995739082355CB660019AEE7 /* AllPassSubscriptionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995739072355CB660019AEE7 /* AllPassSubscriptionViewController.swift */; };
9975225A236B187400ADF673 /* FirstLaunchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99752259236B187400ADF673 /* FirstLaunchController.swift */; };
999D3A67237BFA4600C5F7A8 /* SubscriptionViewBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 999D3A66237BFA4600C5F7A8 /* SubscriptionViewBuilder.swift */; };
99B6A74C2362F5AA002C94CB /* PromoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6A74B2362F5AA002C94CB /* PromoButton.swift */; };
99B6A74E2362F5CD002C94CB /* PromoCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99B6A74D2362F5CD002C94CB /* PromoCoordinator.swift */; };
@ -1682,7 +1681,6 @@
9957FAE0237AE04900855F48 /* MWMMapViewControlsManager+AddPlace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMMapViewControlsManager+AddPlace.h"; sourceTree = "<group>"; };
9957FAE3237AE3CF00855F48 /* DeepLinkCatalogueStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkCatalogueStrategy.swift; sourceTree = "<group>"; };
9957FAEA237AF22800855F48 /* DeepLinkIncorrectStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkIncorrectStrategy.swift; sourceTree = "<group>"; };
99752259236B187400ADF673 /* FirstLaunchController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstLaunchController.swift; sourceTree = "<group>"; };
999D3A60237B088C00C5F7A8 /* DeepLinkSubscriptionStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkSubscriptionStrategy.swift; sourceTree = "<group>"; };
999D3A66237BFA4600C5F7A8 /* SubscriptionViewBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionViewBuilder.swift; sourceTree = "<group>"; };
999D3A68237C0ADD00C5F7A8 /* DeepLinkMapStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkMapStrategy.swift; sourceTree = "<group>"; };
@ -3828,7 +3826,6 @@
children = (
99CB34952369C281001D28AD /* FirstLaunchBuilder.swift */,
99CB34972369C291001D28AD /* FirstLaunchPresenter.swift */,
99752259236B187400ADF673 /* FirstLaunchController.swift */,
);
path = FirstLaunch;
sourceTree = "<group>";
@ -5885,7 +5882,6 @@
34AB66531FC5AA330078E451 /* MWMiPadRoutePreview.m in Sources */,
3454D7E31E07F045004AF2AD /* UITextView+RuntimeAttributes.m in Sources */,
F6A2184A1CA3F26800BE2CC6 /* MWMEditorViralActivityItem.mm in Sources */,
9975225A236B187400ADF673 /* FirstLaunchController.swift in Sources */,
F6E2FED61E097BA00083EBEC /* MWMSearchChangeModeView.mm in Sources */,
33603C85219F0F6300B11FFE /* SharingPropertiesViewController.swift in Sources */,
47699A0821F08E37009E6585 /* NSDate+TimeDistance.m in Sources */,

View file

@ -46,10 +46,6 @@ extension DeepLinkInfoPresenter: IDeepLinkInfoPresenter {
Statistics.logEvent(kStatOnboardingDlAccept, withParameters: [kStatType : host])
}
func key() -> String {
return ""
}
func onClose() {
}

View file

@ -5,18 +5,21 @@ class FirstLaunchBuilder {
title: "new_onboarding_step2_header",
text: "new_onboarding_step2_message",
buttonNextTitle: "new_onboarding_button",
statType: kStatOnboardingDream,
isCloseButtonHidden: true,
requestPermission: .nothing),
FirstLaunchPresenter.FirstLaunchConfig(image: UIImage(named: "img_onboarding_offlinemaps"),
title: "new_onboarding_step3_header",
text: "new_onboarding_step3_message",
buttonNextTitle: "new_onboarding_button",
statType: kStatOnboardingExperience,
isCloseButtonHidden: true,
requestPermission: .notifications),
FirstLaunchPresenter.FirstLaunchConfig(image: UIImage(named: "img_onboarding_sharebookmarks"),
title: "new_onboarding_step4_header",
text: "new_onboarding_step4_message",
buttonNextTitle: "new_onboarding_button_2",
statType: kStatOnboardingShare,
isCloseButtonHidden: true,
requestPermission: .location),
]

View file

@ -1,3 +0,0 @@
class FirstLaunchController: WelcomeViewController {
class var key: String { return toString(self) }
}

View file

@ -13,6 +13,7 @@ class FirstLaunchPresenter {
var title: String
var text: String
var buttonNextTitle: String
var statType: String
var isCloseButtonHidden: Bool
let requestPermission: Permission
}
@ -35,10 +36,6 @@ extension FirstLaunchPresenter: IFirstLaunchPresenter {
viewController?.configure(config: config)
}
func key() -> String {
return FirstLaunchController.key
}
func onAppear() {
switch config.requestPermission {
case .location:
@ -52,9 +49,11 @@ extension FirstLaunchPresenter: IFirstLaunchPresenter {
func onNext() {
router.onNext()
Statistics.logEvent(kStatOnboardingScreenShow, withParameters: [kStatType: config.statType])
}
func onClose() {
router.onClose()
Statistics.logEvent(kStatOnboardingScreenAccept, withParameters: [kStatType: config.statType])
}
}

View file

@ -6,6 +6,7 @@ class PromoDiscoveryPresenter {
private weak var viewController: IWelcomeView?
private let router: IPromoDiscoveryRouter
private let campaign: PromoDiscoveryCampaign
private var statType: String = ""
init(viewController: IWelcomeView,
router: IPromoDiscoveryRouter,
@ -24,32 +25,33 @@ extension PromoDiscoveryPresenter: IPromoRouterPresenter {
viewController?.setTitle(L("new_onboarding_step5.1_header"))
viewController?.setText(L("new_onboarding_step5.1_message"))
viewController?.setNextButtonTitle(L("new_onboarding_step5.1_button"))
statType = kStatOnboardingCatalog
case .buySubscription:
viewController?.setTitleImage(UIImage(named: "img_onboarding_subscribeguides"))
viewController?.setTitle(L("new_onboarding_step5.1_header"))
viewController?.setText(L("new_onboarding_step5.2_message"))
viewController?.setNextButtonTitle(L("new_onboarding_step5.2_button"))
statType = kStatOnboardingSubscription
case .downloadSamples:
viewController?.setTitleImage(UIImage(named: "img_onboarding_samples"))
viewController?.setTitle(L("new_onboarding_step5.1_header"))
viewController?.setText(L("new_onboarding_step5.3_message"))
viewController?.setNextButtonTitle(L("new_onboarding_step5.3_button"))
statType = kStatOnboardingSample
}
}
func key() -> String {
return ""
}
func onAppear() {
Statistics.logEvent(kStatOnboardingScreenShow, withParameters: [kStatType: statType])
}
func onNext() {
router.presentNext()
Statistics.logEvent(kStatOnboardingScreenAccept, withParameters: [kStatType: statType])
}
func onClose() {
router.dissmiss()
Statistics.logEvent(kStatOnboardingScreenDecline, withParameters: [kStatType: statType])
}
}

View file

@ -25,12 +25,8 @@ extension TermsOfUsePresenter: ITermsOfUsePresenter {
view?.setTermsOfUseTitle(String(coreFormat: L("sign_agree_tof_gdpr"), arguments: [termsOfUseLink]))
}
func key() -> String {
return ""
}
func onAppear() {
Statistics.logEvent("OnStart_MapsMeConsent_shown")
Statistics.logEvent(kStatOnboardingScreenShow, withParameters: [kStatType: kStatAgreement])
}
func onNext() {
@ -39,7 +35,7 @@ extension TermsOfUsePresenter: ITermsOfUsePresenter {
WelcomeStorage.termsOfUseLink = termsOfUseLink
WelcomeStorage.acceptTime = Date()
router.onNext()
Statistics.logEvent("OnStart_MapsMeConsent_accepted")
Statistics.logEvent(kStatOnboardingScreenAccept, withParameters: [kStatType: kStatAgreement])
}
func onClose() {

View file

@ -88,17 +88,9 @@ final class WelcomePageController: UIPageViewController {
func nextPage() {
currentController = pageViewController(self, viewControllerAfter: currentController)
if let controller = currentController as? WelcomeViewController {
Statistics.logEvent(kStatEventName(kStatWhatsNew, controller.key),
withParameters: [kStatAction: kStatNext])
}
}
func close() {
if let controller = currentController as? WelcomeViewController {
Statistics.logEvent(kStatEventName(kStatWhatsNew, controller.key),
withParameters: [kStatAction: kStatClose])
}
iPadBackgroundView?.removeFromSuperview()
view.removeFromSuperview()
removeFromParent()
@ -107,10 +99,6 @@ final class WelcomePageController: UIPageViewController {
}
@objc func show() {
if let controller = currentController as? WelcomeViewController {
Statistics.logEvent(kStatEventName(kStatWhatsNew, controller.key),
withParameters: [kStatAction: kStatOpen])
}
parentController.addChildViewController(self)
parentController.view.addSubview(view)
updateFrame()

View file

@ -8,7 +8,6 @@ protocol IWelcomeConfig {
protocol IWelcomePresenter: class {
func configure()
func key() -> String
func onAppear()
func onNext()
func onClose()

View file

@ -51,10 +51,6 @@ class WelcomeViewController: MWMViewController, UIAdaptivePresentationController
@IBAction func onCloseButton(_ sender: UIButton) {
presenter?.onClose()
}
var key: String {
return presenter?.key() ?? ""
}
}
extension WelcomeViewController: IWelcomeView {

View file

@ -14,6 +14,7 @@ class WhatsNewPresenter {
private weak var view: IWelcomeView?
private let router: WelcomeRouter
private let config: WhatsNewConfig
private let appVersion = AppInfo.shared()?.bundleVersion ?? ""
init(view: IWelcomeView, router: WelcomeRouter, config: WhatsNewConfig) {
self.view = view
@ -27,19 +28,20 @@ extension WhatsNewPresenter: IWhatsNewPresenter {
view?.configure(config: config)
}
func key() -> String {
return WhatsNewController.key
}
func onAppear() {
Statistics.logEvent(kStatWhatsNew, withParameters: [kStatAction: kStatOpen,
kStatVersion: appVersion])
}
func onNext() {
router.onNext()
Statistics.logEvent(kStatWhatsNew, withParameters: [kStatAction: kStatNext,
kStatVersion: appVersion])
}
func onClose() {
router.onClose()
Statistics.logEvent(kStatWhatsNew, withParameters: [kStatAction: kStatClose,
kStatVersion: appVersion])
}
}