Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ public enum FeatureAnnouncementCampaign: String, Codable, Equatable {
case upsellCardReaders = "upsell_card_readers"
case linkedProductsPromo = "linked_products_promo"
case productsOnboarding = "products_onboarding_first_product"
case IPP_COD = "ipp_not_user"
case IPP_firstTransaction = "ipp_new_user"
case IPP_powerUsers = "ipp_heavy_user"

/// Added for use in `test_setFeatureAnnouncementDismissed_with_another_campaign_previously_dismissed_keeps_values_for_both`
/// This can be removed when we have a second campaign, which can be used in the above test instead.
Expand Down
53 changes: 53 additions & 0 deletions WooCommerce/Classes/Analytics/WooAnalyticsEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ extension WooAnalyticsEvent {
case orderCreation = "order_creation"
/// Shown in beta feature banner for coupon management.
case couponManagement = "coupon_management"
/// Shown in IPP banner for different number of IPP transactions.
case IPP_COD = "ipp_not_user"
case IPP_firstTransaction = "ipp_new_user"
case IPP_powerUsers = "ipp_heavy_user"
}

/// The action performed on the survey screen.
Expand Down Expand Up @@ -599,6 +603,55 @@ extension WooAnalyticsEvent {
}
}

// MARK: - InPersonPayments Feedback Banner
//
extension WooAnalyticsEvent {
enum InPersonPaymentsFeedback {
/// Possible sources for IPP feedback
///
enum Source: String {
fileprivate static let key = "source"
case orderList = "order_list" // Only one source for the moment
}

/// Keys
///
private enum Keys {
static let campaign = "campaign_name"
static let source = "source"
static let remindLater = "remind_later"
}

static func shown(source: Source, campaign: FeatureAnnouncementCampaign) -> WooAnalyticsEvent {
WooAnalyticsEvent(
statName: .IPPbannerShown, // survey_banner_shown
properties: [
Keys.source: source.rawValue, // order_list
Keys.campaign: campaign.rawValue, // "ipp_not_user/ipp_new_user/ipp_heavy_user"
])
}

static func ctaTapped(source: Source, campaign: FeatureAnnouncementCampaign) -> WooAnalyticsEvent {
WooAnalyticsEvent(statName: .IPPbannerTapped, // survey_banner_cta_tapped
properties: [
Keys.source: source.rawValue, // order_list
Keys.campaign: campaign.rawValue // "ipp_not_user/ipp_new_user/ipp_heavy_user"
])
}

static func dismissed(source: Source,
campaign: FeatureAnnouncementCampaign,
remindLater: Bool) -> WooAnalyticsEvent {
WooAnalyticsEvent(statName: .IPPbannerDismissed, // survey_banner_dismissed
properties: [
Keys.source: source.rawValue, // order_list
Keys.campaign: campaign.rawValue, // "ipp_not_user/ipp_new_user/ipp_heavy_user"
Keys.remindLater: remindLater
])
}
}
}

// MARK: - Feature Announcement Card

extension WooAnalyticsEvent {
Expand Down
5 changes: 5 additions & 0 deletions WooCommerce/Classes/Analytics/WooAnalyticsStat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ public enum WooAnalyticsStat: String {
case featureCardDismissed = "feature_card_dismissed"
case featureCardCtaTapped = "feature_card_cta_tapped"

// MARK: In-Person Payments survey feedback events
case IPPbannerShown = "survey_banner_shown"
case IPPbannerTapped = "survey_banner_cta_tapped"
case IPPbannerDismissed = "survey_banner_dismissed"

// MARK: Just In Time Messages events
case justInTimeMessageCallToActionTapped = "jitm_cta_tapped"
case justInTimeMessageDismissTapped = "jitm_dismissed"
Expand Down
9 changes: 9 additions & 0 deletions WooCommerce/Classes/System/WooConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ extension WooConstants {
case inAppFeedback = "https://automattic.survey.fm/woo-app-general-feedback-user-survey"
#endif

/// URLs for the different IPP surveys
///
#if DEBUG
case IPP_COD, IPP_firstTransaction, IPP_powerUsers = "https://automattic.survey.fm/woo-app-ipp-in-app-feedback-testing"
#else
case IPP_COD = "https://automattic.survey.fm/woo-app-–-cod-survey"
case IPP_firstTransaction = "https://automattic.survey.fm/woo-app-–-ipp-first-transaction-survey"
case IPP_powerUsers = "https://automattic.survey.fm/woo-app-–-ipp-survey-for-power-users"
#endif
/// URL for the products feedback survey
///
case productsFeedback = "https://automattic.survey.fm/woo-app-feature-feedback-products"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ extension SurveyViewController {
case addOnsI1
case orderCreation
case couponManagement
case IPP_COD
case IPP_firstTransaction
case IPP_powerUsers

fileprivate var url: URL {
switch self {
Expand Down Expand Up @@ -102,12 +105,27 @@ extension SurveyViewController {
.asURL()
.tagPlatform("ios")
.tagAppVersion(Bundle.main.bundleVersion())
case .IPP_COD:
return WooConstants.URLs.IPP_COD
.asURL()
.tagPlatform("ios")
.tagAppVersion(Bundle.main.bundleVersion())
case .IPP_firstTransaction:
return WooConstants.URLs.IPP_firstTransaction
.asURL()
.tagPlatform("ios")
.tagAppVersion(Bundle.main.bundleVersion())
case .IPP_powerUsers:
return WooConstants.URLs.IPP_powerUsers
.asURL()
.tagPlatform("ios")
.tagAppVersion(Bundle.main.bundleVersion())
}
}

fileprivate var title: String {
switch self {
case .inAppFeedback:
case .inAppFeedback, .IPP_COD, .IPP_firstTransaction, .IPP_powerUsers:
return Localization.title
case .productsFeedback, .shippingLabelsRelease3Feedback, .addOnsI1, .orderCreation, .couponManagement:
return Localization.giveFeedback
Expand All @@ -129,6 +147,12 @@ extension SurveyViewController {
return .orderCreation
case .couponManagement:
return .couponManagement
case .IPP_COD:
return .IPP_COD
case .IPP_firstTransaction:
return .IPP_firstTransaction
case .IPP_powerUsers:
return .IPP_powerUsers
}
}
}
Expand Down