woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
299 stars 110 forks source link

[Woo POS] M2: Analytics #13277

Open iamgabrielma opened 2 months ago

iamgabrielma commented 2 months ago

Since we've abstracted Analytics to a protocol in preparation for M1, we can inject the abstraction through the entry point and then specialize it as needed for our case:

+ final class POSAnalytics: Analytics {  ... }
+ final class DummyPOSAnalyticsProvider: AnalyticsProvider { ... }

struct PointOfSaleEntryPointView: View { ... 

    init(itemProvider: POSItemProvider,
         hideAppTabBar: @escaping ((Bool) -> Void),
         cardPresentPaymentService: CardPresentPaymentFacade,
         orderService: POSOrderServiceProtocol,
         currencyFormatter: CurrencyFormatter,
+         analyticsService: Analytics) {
        self.hideAppTabBar = hideAppTabBar

        _viewModel = StateObject(wrappedValue: PointOfSaleDashboardViewModel(
            itemProvider: itemProvider,
            cardPresentPaymentService: cardPresentPaymentService,
            orderService: orderService,
            currencyFormatter: currencyFormatter, 
+            analyticsService: analyticsService)
        )
    }
TODO: Task Issue
Create PointOfSaleAnalytics and PointOfSaleTracksProvider https://github.com/woocommerce/woocommerce-ios/pull/13604/
Cart: item_added_to_cart https://github.com/woocommerce/woocommerce-ios/pull/13604
Order: order_creation_failed https://github.com/woocommerce/woocommerce-ios/issues/13613
Payment success: card_present_collect_payment_success https://github.com/woocommerce/woocommerce-ios/issues/13614
Payment failure: card_present_collect_payment_failed https://github.com/woocommerce/woocommerce-ios/issues/13614
dangermattic commented 2 months ago

Thanks for reporting! 👍

iamgabrielma commented 1 month ago

Updated: p91TBi-bNR-p2#comment-12826

We can start with:

Payment Success card_present_collect_payment_success
Payment Flow Error: card_present_collect_payment_failed (error_type: string)
Product Added to Cart: item_added_to_cart
Order Creation Error: order_creation_failed (error_type: string)

Prefix: woocommerceios_pos_*