Skip to content

Commit

Permalink
Analytics update
Browse files Browse the repository at this point in the history
  • Loading branch information
warmkesselj committed Dec 18, 2024
1 parent c03d4eb commit 9cc981e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ShopperInsightsFragment : BaseFragment() {
PresentmentDetails(
ExperimentType.TEST,
ButtonOrder.FIRST,
PageType.HOMEPAGE
PageType.homepage
)
)
}
Expand All @@ -215,7 +215,7 @@ class ShopperInsightsFragment : BaseFragment() {
PresentmentDetails(
ExperimentType.TEST,
ButtonOrder.OTHER,
PageType.HOMEPAGE
PageType.homepage
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ enum class ButtonOrder(internal val stringValue: String) {
/**
* Greater than Eighth place
*/
OTHER("other")
OTHER("other");

fun getStringRepresentation(): String {
return stringValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ enum class ButtonType(internal val stringValue: String) {
/**
* Other button
*/
OTHER("Other"),
OTHER("Other");

fun getStringRepresentation(): String {
return stringValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,55 @@ enum class PageType {
/**
* The homepage
*/
HOMEPAGE,
homepage,

/**
* The about page
*/
ABOUT,
about,

/**
* The contact page
*/
CONTACT,
contact,

/**
* A product category page
*/
PRODUCT_CATEGORY,
product_category,

/**
* The product details page
*/
PRODUCT_DETAILS,
product_details,

/**
* The search page
*/
SEARCH,
search,

/**
* The checkout page
*/
CHECKOUT,
checkout,

/**
* The order review page
*/
ORDER_REVIEW,
order_review,

/**
* The order confirmation page
*/
ORDER_CONFIRMATION,
order_confirmation,

/**
* The mini cart
*/
MINI_CART,
mini_cart,

/**
* Some other page
*/
OTHER
other
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ class ShopperInsightsClient internal constructor(
val params = AnalyticsEventParams(
experiment = presentmentDetails.type?.formattedExperiment(),
shopperSessionId = shopperSessionId,
buttonType = buttonType.toString(),
buttonOrder = presentmentDetails.buttonOrder.toString()
buttonType = buttonType.getStringRepresentation(),
buttonOrder = presentmentDetails.buttonOrder.getStringRepresentation(),
pageType = presentmentDetails.pageType.toString()
)

braintreeClient.sendAnalyticsEvent(BUTTON_PRESENTED, params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class ShopperInsightsClientUnitTest {
val presentmentDetails = PresentmentDetails(
ExperimentType.TEST,
ButtonOrder.FIRST,
PageType.MINI_CART
PageType.mini_cart
)

val params = AnalyticsEventParams(
Expand All @@ -457,7 +457,7 @@ class ShopperInsightsClientUnitTest {
PresentmentDetails(
ExperimentType.TEST,
ButtonOrder.FIRST,
PageType.MINI_CART
PageType.mini_cart
)
)
verify { braintreeClient.sendAnalyticsEvent("shopper-insights:button-presented",
Expand All @@ -471,7 +471,7 @@ class ShopperInsightsClientUnitTest {
val presentmentDetails = PresentmentDetails(
ExperimentType.CONTROL,
ButtonOrder.SECOND,
PageType.HOMEPAGE
PageType.homepage
)

val params = AnalyticsEventParams(
Expand All @@ -485,7 +485,7 @@ class ShopperInsightsClientUnitTest {
PresentmentDetails(
ExperimentType.CONTROL,
ButtonOrder.SECOND,
PageType.HOMEPAGE
PageType.homepage
)
)
verify { braintreeClient.sendAnalyticsEvent("shopper-insights:button-presented",
Expand Down

0 comments on commit 9cc981e

Please sign in to comment.