From 83e6e3e89687cef28f0245973a6e83b604cd257c Mon Sep 17 00:00:00 2001 From: Justin Warmkessel Date: Thu, 19 Dec 2024 11:16:38 -0800 Subject: [PATCH] Remove PresentmentDetails from selected analytics --- .../demo/ShopperInsightsFragment.kt | 14 ++------ .../shopperinsights/ShopperInsightsClient.kt | 7 ---- .../ShopperInsightsClientUnitTest.kt | 34 ++----------------- 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragment.kt b/Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragment.kt index b3d48307e7..d6a666f376 100644 --- a/Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragment.kt +++ b/Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragment.kt @@ -237,12 +237,7 @@ class ShopperInsightsFragment : BaseFragment() { private fun launchPayPalVault() { shopperInsightsClient.sendSelectedEvent( - ButtonType.PAYPAL, - PresentmentDetails( - ExperimentType.CONTROL, - ButtonOrder.FIRST, - PageType.ORDER_CONFIRMATION - ) + ButtonType.PAYPAL ) payPalClient.createPaymentAuthRequest( @@ -282,12 +277,7 @@ class ShopperInsightsFragment : BaseFragment() { private fun launchVenmo() { shopperInsightsClient.sendSelectedEvent( - ButtonType.VENMO, - PresentmentDetails( - ExperimentType.TEST, - ButtonOrder.THIRD, - PageType.ORDER_REVIEW - ) + ButtonType.VENMO ) val venmoRequest = VenmoRequest(VenmoPaymentMethodUsage.SINGLE_USE) diff --git a/ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClient.kt b/ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClient.kt index 30b269bf06..169b1420a9 100644 --- a/ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClient.kt +++ b/ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClient.kt @@ -191,20 +191,13 @@ class ShopperInsightsClient internal constructor( * Call this method when the PayPal, Venmo or Other button has been successfully displayed to the buyer. * This method sends analytics to help improve the Shopper Insights feature experience. * @param buttonType Type of button presented - PayPal, Venmo, or Other. - * @param presentmentDetails Detailed information, including button order, experiment type, - * and page type about the payment button that is sent to analytics to help improve the Shopper - * Insights feature experience. */ fun sendSelectedEvent( buttonType: ButtonType, - presentmentDetails: PresentmentDetails ) { val params = AnalyticsEventParams( - experiment = presentmentDetails.type?.formattedExperiment(), shopperSessionId = shopperSessionId, buttonType = buttonType.getStringRepresentation(), - buttonOrder = presentmentDetails.buttonOrder.getStringRepresentation(), - pageType = presentmentDetails.pageType.getStringRepresentation() ) braintreeClient.sendAnalyticsEvent(BUTTON_SELECTED, params) diff --git a/ShopperInsights/src/test/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClientUnitTest.kt b/ShopperInsights/src/test/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClientUnitTest.kt index a4cc230d34..146dd23a9b 100644 --- a/ShopperInsights/src/test/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClientUnitTest.kt +++ b/ShopperInsights/src/test/java/com/braintreepayments/api/shopperinsights/ShopperInsightsClientUnitTest.kt @@ -495,27 +495,12 @@ class ShopperInsightsClientUnitTest { @Test fun `test paypal selected analytics event`() { - // A Test type, with a button in the first position displayed in the mini cart. - val presentmentDetails = PresentmentDetails( - ExperimentType.TEST, - ButtonOrder.FIRST, - PageType.MINI_CART - ) - val params = AnalyticsEventParams( - experiment = presentmentDetails?.type?.formattedExperiment(), shopperSessionId = shopperSessionId, - buttonType = ButtonType.PAYPAL.getStringRepresentation(), - buttonOrder = presentmentDetails.buttonOrder.getStringRepresentation(), - pageType = presentmentDetails.pageType.getStringRepresentation() + buttonType = ButtonType.PAYPAL.getStringRepresentation() ) sut.sendSelectedEvent( - ButtonType.PAYPAL, - PresentmentDetails( - ExperimentType.TEST, - ButtonOrder.FIRST, - PageType.MINI_CART - ) + ButtonType.PAYPAL ) verify { braintreeClient.sendAnalyticsEvent("shopper-insights:button-selected", params) } @@ -523,27 +508,12 @@ class ShopperInsightsClientUnitTest { @Test fun `test venmo selected analytics event`() { - // A Test type, with a button in the first position displayed in the mini cart. - val presentmentDetails = PresentmentDetails( - ExperimentType.TEST, - ButtonOrder.FIRST, - PageType.MINI_CART - ) - val params = AnalyticsEventParams( - experiment = presentmentDetails?.type?.formattedExperiment(), shopperSessionId = shopperSessionId, buttonType = ButtonType.VENMO.getStringRepresentation(), - buttonOrder = presentmentDetails.buttonOrder.getStringRepresentation(), - pageType = presentmentDetails.pageType.getStringRepresentation() ) sut.sendSelectedEvent( ButtonType.VENMO, - PresentmentDetails( - ExperimentType.TEST, - ButtonOrder.FIRST, - PageType.MINI_CART - ) ) verify { braintreeClient.sendAnalyticsEvent("shopper-insights:button-selected", params) }