-
Notifications
You must be signed in to change notification settings - Fork 42
[SDK-231] Add click handling tracking #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: loren/embedded/SDK-232-ios-add-start-impression-and-pause-impression-a
Are you sure you want to change the base?
[SDK-231] Add click handling tracking #799
Conversation
|
Coverage Impact This PR will not change total coverage. 🚦 See full report on Qlty Cloud »🛟 Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds click tracking functionality for embedded messages in the iOS native layer. The implementation enables tracking user interactions with embedded messages, including button clicks with optional button identifiers and click URLs.
Changes:
- Added
trackEmbeddedClickmethod in Swift to handle embedded message click tracking with validation - Implemented TurboModule and legacy React Native bridge bindings in Objective-C++
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ios/RNIterableAPI/ReactIterableAPI.swift | Added trackEmbeddedClick method that extracts message ID, looks up the cached message, validates parameters, and calls the native SDK tracking API |
| ios/RNIterableAPI/RNIterableAPI.mm | Added TurboModule bridge implementation to convert C++ types to NSDictionary and legacy architecture bridge export for React Native compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| guard let clickedUrl = clickedUrl else { | ||
| ITBError("clickedUrl is required for trackEmbeddedClick") | ||
| return | ||
| } |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clickedUrl validation should be moved earlier in the function, before extracting the messageId and looking up the message in the cache. This would avoid unnecessary work when clickedUrl is null. Consider moving this check right after the ITBInfo() call to fail fast.
|
|
||
| #if RCT_NEW_ARCH_ENABLED | ||
| #import "RNIterableAPISpec.h" | ||
| #import <string> |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <string> header is imported but doesn't appear to be used in the visible code. If this import is not required by the generated RNIterableAPISpec.h header, consider removing it to keep the imports clean.
| #import <string> |
Ayyanchira
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with some possible suggestions
|
|
||
| // Find the message in the embedded manager's cache | ||
| let messages = IterableAPI.embeddedManager.getMessages() | ||
| guard let embeddedMessage = messages.first(where: { $0.metadata.messageId == messageId }) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this check for embedded message be avoided by using the method's input parameter? But it can make sense if EmbeddedMessage is not guaranteed to receive everytime.
|
|
||
| @objc(trackEmbeddedClick:buttonId:clickedUrl:) | ||
| public func trackEmbeddedClick( | ||
| message: NSDictionary, buttonId: String?, clickedUrl: String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the message be of type EmbeddedMessage instead of generic string?

🔹 JIRA Ticket(s) if any
✏️ Description
Added click handling and tracking
Testing
Setup
yarn installyarn installbundle exec pod installwatchman watch-del-allyarn start --reset-cacheopen ReactNativeSdkExample.xcworkspace