Skip to content

Commit

Permalink
Remove PresentmentDetails from selected analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
warmkesselj committed Dec 19, 2024
1 parent faba024 commit 83e6e3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,55 +495,25 @@ 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) }
}

@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) }
Expand Down

0 comments on commit 83e6e3e

Please sign in to comment.