Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abstract_target 'WordPress_Base' do
pod 'NSURL+IDN', '0.3'
pod 'WPMediaPicker', '~> 0.10.2'
pod 'WordPress-iOS-Editor', '1.8.1'
pod 'WordPressCom-Analytics-iOS', '0.1.21'
pod 'WordPressCom-Analytics-iOS', '0.1.22'
pod 'WordPress-Aztec-iOS', :git => 'https://github.com/wordpress-mobile/WordPress-Aztec-iOS.git', :branch => 'swift-3/gridicons-bump'
pod 'wpxmlrpc', '~> 0.8'

Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ PODS:
- WordPressCom-Analytics-iOS (~> 0.1.0)
- WordPress-iOS-Shared (0.7.0):
- CocoaLumberjack (~> 2.2.0)
- WordPressCom-Analytics-iOS (0.1.21)
- WordPressCom-Analytics-iOS (0.1.22)
- WordPressCom-Stats-iOS (0.8.1):
- AFNetworking (~> 3.1.0)
- CocoaLumberjack (~> 2.2.0)
Expand Down Expand Up @@ -179,7 +179,7 @@ DEPENDENCIES:
- WordPress-Aztec-iOS (from `https://github.com/wordpress-mobile/WordPress-Aztec-iOS.git`, branch `swift-3/gridicons-bump`)
- WordPress-iOS-Editor (= 1.8.1)
- WordPress-iOS-Shared (= 0.7.0)
- WordPressCom-Analytics-iOS (= 0.1.21)
- WordPressCom-Analytics-iOS (= 0.1.22)
- WordPressCom-Stats-iOS (= 0.8.1)
- WordPressComKit (from `https://github.com/Automattic/WordPressComKit.git`, tag `0.0.6`)
- WPMediaPicker (~> 0.10.2)
Expand Down Expand Up @@ -252,12 +252,12 @@ SPEC CHECKSUMS:
WordPress-Aztec-iOS: f341ceec424ace839036e6556543dd20c1285d77
WordPress-iOS-Editor: 3118f5d6b142b6bf322f3393a7dd98a28bca68cb
WordPress-iOS-Shared: 4bec543bac6543480b10d904bea122dcba43cc37
WordPressCom-Analytics-iOS: ee6cc3a4feb63cebba167ce762c6e12c0b7b6671
WordPressCom-Analytics-iOS: 66b890823ffd54aee871fbba3ed0278d4ae1aa0a
WordPressCom-Stats-iOS: 07b1796831c31c0c8c8a0f2e314bb2e6636af5df
WordPressComKit: 119ae1d20bfb090769274732b51e7bd186a96f7e
WPMediaPicker: 9ba8c29a1de4b07696356f541c01eeaa6dd14c47
wpxmlrpc: 38623cc415117914d6ab5bf2ab8a57a4076cc469

PODFILE CHECKSUM: dab129240204c69bb8cb9cb240ceb4c675285a9c
PODFILE CHECKSUM: 7c82d248e2b7ea96dd64eeb001bd3589a9e241f5

COCOAPODS: 1.1.1
25 changes: 23 additions & 2 deletions WordPress/Classes/Services/SignupService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,25 @@ open class SignupService: LocalCoreDataService
self.createWPComBlogForParams(params, account: account, status: status, success: createWPComBlogSuccessBlock, failure: failure)
}

let createAccountFailureBlock: SignupFailureBlock = { error in
self.trackAccountCreationError(error)

WPAppAnalytics.track(.createAccountFailed)
failure(error)
}

let createWPComUserSuccessBlock = {
// When the user is successfully created, authenticate.
self.signinWPComUserWithParams(params, status: status, success: signinWPComUserSuccessBlock, failure: failure)
}

let validateBlogSuccessBlock = {
// When the blog is successfully validated, create the WPCom user.
self.createWPComUserWithParams(params, status: status, success: createWPComUserSuccessBlock, failure: failure)
self.createWPComUserWithParams(params, status: status, success: createWPComUserSuccessBlock, failure: createAccountFailureBlock)
}

// To start the process, validate the blog information.
validateWPComBlogWithParams(params, status: status, success: validateBlogSuccessBlock, failure: failure)
validateWPComBlogWithParams(params, status: status, success: validateBlogSuccessBlock, failure: createAccountFailureBlock)
}


Expand Down Expand Up @@ -333,6 +340,20 @@ open class SignupService: LocalCoreDataService
return WordPressComRestApi(userAgent: WPUserAgent.wordPress())
}

func trackAccountCreationError(_ error: Error?) {
if let error = error as? NSError,
let errorCode = error.userInfo[WordPressComRestApi.ErrorKeyErrorCode] as? String {
switch errorCode {
case "username_exists":
WPAppAnalytics.track(.createAccountUsernameExists)
case "email_exists":
WPAppAnalytics.track(.createAccountEmailExists)
default: break
}

}
}

/// An internal struct for conveniently sharing params between the different
/// sign up steps.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ + (TracksEventPair *)eventPairForStat:(WPAnalyticsStat)stat
case WPAnalyticsStatAppReviewsSentFeedback:
eventName = @"app_reviews_feedback_sent";
break;
case WPAnalyticsStatCreateAccountInitiated:
eventName = @"account_create_initiated";
break;
case WPAnalyticsStatCreateAccountEmailExists:
eventName = @"account_create_email_exists";
break;
case WPAnalyticsStatCreateAccountUsernameExists:
eventName = @"account_create_username_exists";
break;
case WPAnalyticsStatCreateAccountFailed:
eventName = @"account_create_failed";
break;
case WPAnalyticsStatCreatedAccount:
eventName = @"account_created";
break;
Expand Down Expand Up @@ -432,6 +444,9 @@ + (TracksEventPair *)eventPairForStat:(WPAnalyticsStat)stat
eventName = @"site_menu_opened";
eventProperties = @{ TracksEventPropertyMenuItemKey : @"comments" };
break;
case WPAnalyticsStatOpenedLogin:
eventName = @"login_accessed";
break;
case WPAnalyticsStatOpenedMediaLibrary:
eventName = @"site_menu_opened";
eventProperties = @{ TracksEventPropertyMenuItemKey : @"library" };
Expand Down
25 changes: 25 additions & 0 deletions WordPress/Classes/Utility/Analytics/WPAnalyticsTrackerMixpanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ - (WPAnalyticsTrackerMixpanelInstructionsForStat *)instructionsForStat:(WPAnalyt
case WPAnalyticsStatOnePasswordFailed:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"1Password - Extension Failure"];
break;
case WPAnalyticsStatOpenedLogin:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Login - Accessed"];
[instructions setSuperPropertyAndPeoplePropertyToIncrement:@"number_of_times_login_accessed"];
[instructions setCurrentDateForPeopleProperty:@"last_time_login_accessed"];
break;
case WPAnalyticsStatOpenedPosts:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Site Menu - Opened Posts"];
break;
Expand Down Expand Up @@ -704,6 +709,26 @@ - (WPAnalyticsTrackerMixpanelInstructionsForStat *)instructionsForStat:(WPAnalyt
case WPAnalyticsStatOpenedSupport:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Support - Accessed"];
break;
case WPAnalyticsStatCreateAccountInitiated:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Create Account - Initiated"];
[instructions setSuperPropertyAndPeoplePropertyToIncrement:@"number_of_times_create_account_initiated"];
[instructions setCurrentDateForPeopleProperty:@"last_time_create_account_initiated"];
break;
case WPAnalyticsStatCreateAccountEmailExists:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Create Account - Email Exists"];
[instructions setSuperPropertyAndPeoplePropertyToIncrement:@"number_of_times_create_account_email_exists"];
[instructions setCurrentDateForPeopleProperty:@"last_time_create_account_email_exists"];
break;
case WPAnalyticsStatCreateAccountUsernameExists:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Create Account - Username Exists"];
[instructions setSuperPropertyAndPeoplePropertyToIncrement:@"number_of_times_create_account_username_exists"];
[instructions setCurrentDateForPeopleProperty:@"last_time_create_account_username_exists"];
break;
case WPAnalyticsStatCreateAccountFailed:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Create Account - Failed"];
[instructions setSuperPropertyAndPeoplePropertyToIncrement:@"number_of_times_create_account_failed"];
[instructions setCurrentDateForPeopleProperty:@"last_time_create_account_failed"];
break;
case WPAnalyticsStatCreatedAccount:
instructions = [WPAnalyticsTrackerMixpanelInstructionsForStat mixpanelInstructionsForEventName:@"Created Account"];
[instructions setCurrentDateForPeopleProperty:@"$created"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ import WordPressShared
@IBAction func handleCreateSiteButtonTapped(_ sender: UIButton) {
let controller = SignupViewController.controller()
navigationController?.pushViewController(controller, animated: true)

WPAppAnalytics.track(.createAccountInitiated)
}


Expand Down
12 changes: 12 additions & 0 deletions WordPress/Classes/ViewRelated/NUX/SigninHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import Mixpanel
let controller = createControllerForSigninFlow(showsEditor: thenEditor)
let navController = NUXNavigationController(rootViewController: controller)
presenter.present(navController, animated: animated, completion: nil)

trackOpenedLogin()
}


Expand All @@ -42,6 +44,8 @@ import Mixpanel

let navController = NUXNavigationController(rootViewController: controller)
presenter.present(navController, animated: true, completion: nil)

trackOpenedLogin()
}


Expand All @@ -50,6 +54,8 @@ import Mixpanel
let controller = SigninSelfHostedViewController.controller(LoginFields())
let navController = NUXNavigationController(rootViewController: controller)
presenter.present(navController, animated: true, completion: nil)

trackOpenedLogin()
}


Expand All @@ -74,6 +80,12 @@ import Mixpanel
let presenter = UIApplication.shared.keyWindow?.rootViewController
let navController = NUXNavigationController(rootViewController: controller)
presenter?.present(navController, animated: true, completion: nil)

trackOpenedLogin()
}

private class func trackOpenedLogin() {
WPAppAnalytics.track(.openedLogin)
}


Expand Down