Skip to content

fix: Forward impression events and products instead of null events - #355

Closed
mmustafa-tse wants to merge 2 commits into
mParticle:mainfrom
mmustafa-tse:fix/impressionEvent
Closed

fix: Forward impression events and products instead of null events#355
mmustafa-tse wants to merge 2 commits into
mParticle:mainfrom
mmustafa-tse:fix/impressionEvent

Conversation

@mmustafa-tse

Copy link
Copy Markdown
Contributor

Summary

A customer reported that Impression events sent from React Native SDK are being received as null in the UI, after further investigation it seems the iOS react native bridge was missing the logic to handle impressions in logCommerceEvents.

Testing Plan

Tested E2E by changing the code locally:
Screenshot 2026-07-06 at 2 49 15 PM

Screenshot 2026-07-06 at 2 06 18 PM Screenshot 2026-07-06 at 2 08 48 PM

Master Issue

Closes https://rokt.atlassian.net/browse/SDKE-1210

@mmustafa-tse
mmustafa-tse requested a review from a team as a code owner July 6, 2026 21:53
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes analytics payload shape for impression-only commerce on New Arch iOS; SDK minimum bump may force pod updates for integrators on 9.2.0–9.2.1.

Overview
Fixes impression commerce events showing as null in mParticle when apps use the React Native New Architecture on iOS. The TurboModule logCommerceEvent path now maps impressions (list name + products) onto MPCommerceEvent via addImpression:product listName:, matching the existing legacy RCTConvert behavior and Android.

In the same New Arch product mapping, price is only set when present, so missing prices no longer always serialize as 0.

Dependency: mParticle-Apple-SDK-ObjC is pinned to >= 9.2.2 in the podspec and sample Podfile so CocoaPods cannot resolve 9.2.0/9.2.1, which lack deviceConsentState and break bridge compilation.

Reviewed by Cursor Bugbot for commit e264e8d. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread ios/RNMParticle/RNMParticle.mm Outdated
NSMutableDictionary *productDict = [[NSMutableDictionary alloc] init];
if (productStruct.name()) productDict[@"name"] = productStruct.name();
if (productStruct.sku()) productDict[@"sku"] = productStruct.sku();
productDict[@"price"] = @(productStruct.price());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason price doesn't have a conditional whereas all the others do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmi22186 - I pretty much copied the same logic on for commerceEvent.products().has_value() in line 513, I can add the if statement for both to be on the safer side

@rmi22186 rmi22186 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this is new architecture that doesn't support it, not the old arch, the old arch supports, so the PR description is slightly off.

@rmi22186

Copy link
Copy Markdown
Member

Also the iOS test app is not building. Take a look at that.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit e264e8d. Configure here.

if (productStruct.name()) productDict[@"name"] = productStruct.name();
if (productStruct.sku()) productDict[@"sku"] = productStruct.sku();
productDict[@"price"] = @(productStruct.price());
if (productStruct.price()) productDict[@"price"] = @(productStruct.price());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zero price silently drops products

Medium Severity

price is a required non-optional number on Product, unlike optional fields that use .has_value(). Guarding with if (productStruct.price()) treats 0 as absent, so the key is omitted and createMPProductFromDict returns nil. Free products are then dropped from commerce events and impressions.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e264e8d. Configure here.

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.

2 participants