Skip to content

feat: Support Braze 42 and recommended eCommerce events#192

Open
nickolas-dimitrakas wants to merge 2 commits into
mainfrom
feat/recommended-ecommerce-events
Open

feat: Support Braze 42 and recommended eCommerce events#192
nickolas-dimitrakas wants to merge 2 commits into
mainfrom
feat/recommended-ecommerce-events

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown

Background

Braze Android SDK 42.3.0+ introduces recommended eCommerce events (ecommerce.cart_updated, ecommerce.checkout_started, ecommerce.product_viewed, ecommerce.order_placed, ecommerce.order_refunded) as typed SDK APIs that unlock calculated profile fields, eCommerce reporting, and out-of-the-box Canvas templates. This mirrors the iOS work in mparticle-apple-sdk#793.

What changed

  • Bumped the kit to Braze Android SDK 42.x (com.braze:android-sdk-ui:[42.3.0,43.0.0)) and Kotlin 2.2.20 (required by Braze 42).

  • New opt-in useEcommerceRecommendedEvents setting. When enabled, the six supported mParticle commerce actions map to Braze's recommended events via logEcommerceEvent (and logCustomEvent for ecommerce.order_refunded, which has no typed API):

    mParticle action Braze event
    add_to_cart / remove_from_cart ecommerce.cart_updated (action add/remove)
    checkout ecommerce.checkout_started
    view_detail ecommerce.product_viewed (one per product)
    purchase ecommerce.order_placed
    refund ecommerce.order_refunded
  • When the setting is off (default), commerce forwarding is unchanged. Unsupported actions and events without products fall back to legacy forwarding.

  • Attributes without a direct Braze field (cart_id, checkout_id, source, tax, shipping, product brand/category/coupon_code/position, etc.) are nested in event/product metadata per Braze's strict schema. source is "android".

Testing

  • ./gradlew testReleaseUnitTestall unit tests pass (new recommended-eCommerce tests covering each mapped event + fallback paths, plus the existing suite). ktlintCheck clean. Compiles against the real Braze 42.3.x AAR.

🤖 Generated with Claude Code

nickolas-dimitrakas and others added 2 commits July 6, 2026 17:00
Bump the kit to Braze Android SDK 42.x (com.braze:android-sdk-ui:[42.3.0,43.0.0),
Kotlin 2.2.20) and add an opt-in `useEcommerceRecommendedEvents` setting that
forwards the six supported mParticle commerce actions using Braze's recommended
eCommerce event schema (cart_updated, checkout_started, product_viewed,
order_placed, and order_refunded via logCustomEvent).

Legacy commerce forwarding remains the default; unsupported actions and events
without products fall back to it. Attributes without a direct Braze field are
nested in event/product metadata per Braze's strict schema; source is "android".

Adds unit tests for each mapped event and the legacy fallback paths (extends the
Braze test mock with logEcommerceEvent and the recommended eCommerce event types).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
buildEventMetadataMap copied every commerce custom attribute into the event
metadata object, including cart_id, checkout_id, and total_discounts, which are
also promoted to typed recommended-event fields — so they appeared twice on the
outbound event. Exclude the promoted keys from metadata; genuinely custom
attributes are unaffected. Adds assertions covering the dedup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant