feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin#9014
feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin#9014sokoloff06 wants to merge 1 commit into
Conversation
…on in iOS Expo plugin
|
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new configuration option for the iOS Expo plugin, allowing developers to easily enable Google Analytics on-device conversion measurement. By updating the plugin to handle this specific Podfile flag, the change streamlines the integration process for users of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for the googleAppMeasurementOnDeviceConversion configuration in the Expo plugin for iOS. It adds a new property to the plugin configuration, implements the logic to modify the Podfile accordingly, and includes comprehensive tests to ensure the flag is correctly added, removed, and handled idempotently. Feedback was provided to refactor the Podfile modification logic into a shared helper function to reduce code duplication between similar features.
| export function setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion( | ||
| src: string, | ||
| enabled: boolean = false, | ||
| ): string { | ||
| if (!enabled) { | ||
| return removeGeneratedContents(src, TAG_ODM) ?? src; | ||
| } | ||
|
|
||
| return mergeContents({ | ||
| src, | ||
| newSrc: FLAG_ODM, | ||
| tag: TAG_ODM, | ||
| anchor: ANCHOR, | ||
| offset: 1, | ||
| comment: '#', | ||
| }).contents; | ||
| } |
There was a problem hiding this comment.
The logic in setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion is identical to setAnalyticsPodfileWithoutAdIdSupport. To improve maintainability and reduce duplication, consider extracting this into a shared helper function that takes the tag and flag as arguments.
function setPodfileFlag(src: string, tag: string, flag: string, enabled: boolean): string {
if (!enabled) {
return removeGeneratedContents(src, tag) ?? src;
}
return mergeContents({
src,
newSrc: flag,
tag,
anchor: ANCHOR,
offset: 1,
comment: '#',
}).contents;
}
export function setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
src: string,
enabled: boolean = false,
): string {
return setPodfileFlag(src, TAG_ODM, FLAG_ODM, enabled);
}
Description
This PR adds support for the
googleAppMeasurementOnDeviceConversionconfiguration option in the iOS Expo plugin for@react-native-firebase/analytics.Enabling this option adds
$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = trueto the project's Podfile, allowing users to enable Google Analytics on-device conversion measurement in their Expo projects.Related issues
None.
Release Summary
feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin
Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__Test Plan
Added 3 new Jest tests in
packages/analytics/plugin/__tests__/iosPlugin.test.tsto verify:🔥
Note
Low Risk
Low risk: adds a new optional iOS Podfile flag injection/removal path using the existing generated-code mechanism, plus unit tests; limited to build-time configuration changes.
Overview
Adds a new iOS plugin option,
ios.googleAppMeasurementOnDeviceConversion, that conditionally injects (and can remove) a generated Podfile snippet setting$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true.Wires this new config plugin into the main analytics Expo plugin pipeline and extends Jest coverage/snapshots to verify insertion, idempotency, and removal behavior.
Reviewed by Cursor Bugbot for commit 8b45540. Bugbot is set up for automated code reviews on this repo. Configure here.