Skip to content

feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin#9014

Open
sokoloff06 wants to merge 1 commit into
invertase:mainfrom
sokoloff06:add-odm-plugin
Open

feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin#9014
sokoloff06 wants to merge 1 commit into
invertase:mainfrom
sokoloff06:add-odm-plugin

Conversation

@sokoloff06
Copy link
Copy Markdown

@sokoloff06 sokoloff06 commented May 11, 2026

Description

This PR adds support for the googleAppMeasurementOnDeviceConversion configuration option in the iOS Expo plugin for @react-native-firebase/analytics.

Enabling this option adds $RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true to 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

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Added 3 new Jest tests in packages/analytics/plugin/__tests__/iosPlugin.test.ts to verify:

  1. The Podfile flag is added correctly when the option is enabled.
  2. The modification is idempotent.
  3. The flag is removed when the option is disabled.

🔥


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.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 @react-native-firebase/analytics package.

Highlights

  • Feature Addition: Added support for the googleAppMeasurementOnDeviceConversion configuration option in the iOS Expo plugin for @react-native-firebase/analytics.
  • Podfile Integration: The plugin now automatically injects the $RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true flag into the project's Podfile when enabled.
  • Testing: Included new Jest unit tests to verify the flag addition, idempotency, and removal functionality.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sokoloff06 sokoloff06 changed the title feat(analytics): add googleAppMeasurementOnDeviceConversion to iOS Expo plugin feat(analytics): add support for googleAppMeasurementOnDeviceConversion in iOS Expo plugin May 11, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +33 to +49
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;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

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);
}

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