feat: Support Braze 43 and recommended eCommerce events - #728
Conversation
PR SummaryMedium Risk Overview The main behavioral addition is an opt-in connection setting CI ( Reviewed by Cursor Bugbot for commit 80610cb. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Thanks @cursor — addressing both findings from the latest review: 1. "Mapped IDs duplicated in metadata" — fixed ( 2. "SKU replacement flag ignored" — working as intended, no change. |
BrandonStalnaker
left a comment
There was a problem hiding this comment.
Matches what was done on the iOS side as expected. AI recommended some cleanup that might be worth it but isn't necessary to merge
|
Add a new isolated braze-42 kit track targeting Braze Android SDK 42.x (com.braze:android-sdk-ui:[42.3.0,43.0.0)). Because Braze 42 requires Kotlin 2.2.x, the track is built standalone following the urbanairship-20 convention: excluded from settings-kits.gradle, with its own Kotlin 2.2.20 buildscript and dedicated CI steps. 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 reported as "android". Includes unit tests for each mapped event and the legacy fallback paths, and wires the isolated track into the pull-request and daily CI workflows, ONBOARDING.md, and CHANGELOG.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The example app's applicationId had a duplicated prefix (com.mparticle.com.mparticle.kits.braze.example) while the manifest package and the MPReceiver FCM intent-filter category are com.mparticle.kits.braze.example. Since the effective package equals the applicationId, the push category no longer matched, so push registration/receipt in the sample app could fail. Align the applicationId with the package and category. 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. Those values therefore appeared twice on the outbound event (and total_discounts as an inconsistent string copy). 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>
Explicitly declare android:exported on components with intent-filters (MPReceiver, MainActivity) and android:usesCleartextTraffic="false" on both example apps' <application> tags. Also flips the Kotlin example's allowBackup to false to match the Java example and avoid disabling backup review flags. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…fields Promote TransactionAttributes tax/shipping and custom attribute subtotal_value onto Braze 43 CartUpdatedEvent, CheckoutStartedEvent, and OrderPlacedEvent, and retarget the kit to Braze [43.0.0,44.0.0).
184bdc3 to
8681bb9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8681bb9. Configure here.



Background
Braze Android SDK 40.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. Braze 43.0.0 adds optional typed subtotalValue, tax, and shipping fields on CartUpdatedEvent, CheckoutStartedEvent, and OrderPlacedEvent. This mirrors the iOS work in
mparticle-apple-sdk#793.
What changed
New braze-43 kit track targeting com.braze:android-sdk-ui:[43.0.0,44.0.0) (namespace appboy43, artifact com.mparticle:braze-43), evolved from braze-41 (via an intermediate braze-42 track that was renamed to align with Braze 43).
Braze 43 requires Kotlin 2.2.x, so the track is built standalone following the urbanairship-20 convention: excluded from settings-kits.gradle, its own Kotlin 2.2.20 buildscript, and dedicated CI steps in pull-request.yml / daily.yml. Documented in ONBOARDING.md.
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):
ecommerce.cart_updated(action add/remove)ecommerce.checkout_startedecommerce.product_viewed(one per product)ecommerce.order_placedecommerce.order_refundedWhen the setting is off (default), commerce forwarding is unchanged. Unsupported actions and events without products fall back to legacy forwarding.
Braze 43 typed field mapping:
TransactionAttributes.tax → typed tax
TransactionAttributes.shipping → typed shipping
commerce custom attribute subtotal_value → typed subtotalValue
Same values are also sent as top-level properties on ecommerce.order_refunded custom events
Promoted fields are excluded from metadata to avoid duplication
Attributes without a direct Braze field (affiliation, product brand/category/coupon_code/position, etc.) remain nested in event/product metadata per Braze's strict schema. source is "android".
Testing
Notes