Skip to content

Conversation

@AustinBenoit
Copy link
Contributor

@AustinBenoit AustinBenoit commented Nov 4, 2025

Description

Feat: add SetDefaultEventParameters and have EventLog to take in a vector.

The SetDefaultEventParameters has been updated for iOS and Android. However the desktop implementation is only stubbed out. The SetDefaultEventParameters adds parameters that will be set on every event logged from the SDK, including automatic ones. The values passed in the parameters dictionary will be added to the dictionary of default event parameters. These parameters persist across app runs.

To make the SDK more modern EventLog and SetDefaultEventParameters will take in a vector of event parameters.

To ensure that the SetDefaultEventParameters works as expected the Parameters of type Double in the Android SDK has been updated to pass along a Double type to the Android implementation.


Testing

Test locally with both iOS and Android.

iOS:
image

Android:
image

Added in an integration test for SetDefaultEventParameters.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

This brings the Android SDK into parity for C++.
This adds in the iOS setdefaulteventparameters.
Along with that I will make the setdefaulteventparameters and logevent take in
vector for the parameters.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AustinBenoit, 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 enhances the Firebase Analytics C++ SDK by adding the ability to set default event parameters that are automatically attached to all subsequent events. It also modernizes the LogEvent API by introducing an overload that accepts parameters as a std::vector, improving usability and consistency with modern C++ practices. The changes include platform-specific implementations for Android and iOS, along with desktop stubs and an integration test.

Highlights

  • New Feature: SetDefaultEventParameters: Introduced SetDefaultEventParameters for Firebase Analytics on Android and iOS, allowing developers to define parameters that are automatically included with every logged event. These parameters persist across app runs and have lower precedence than event-specific parameters.
  • LogEvent with std::vector: The LogEvent function now includes an overload that accepts parameters as a std::vector<Parameter>, providing a more idiomatic C++ interface for logging events.
  • Android JNI Improvements: Corrected the JNI binding for double values in Android, ensuring AddToBundle correctly uses kPutDouble instead of kPutFloat.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AustinBenoit, 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 enhances the Firebase Analytics C++ SDK by introducing the ability to define default event parameters that are automatically included with every logged event. It also improves the LogEvent API by adding an overload that accepts a std::vector of parameters, offering a more modern C++ interface for event logging. These changes aim to streamline event tracking and parameter management for developers.

Highlights

  • Default Event Parameters: Introduced SetDefaultEventParameters API for Firebase Analytics on Android and iOS, allowing global parameters to be set for all subsequent events. These parameters persist across app runs and have lower precedence than event-specific parameters.
  • Vector-based LogEvent: Added an overloaded LogEvent function that accepts a std::vector<Parameter>, providing a more C++ idiomatic and convenient way to pass event parameters.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AustinBenoit, 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 the ability to set default event parameters in Firebase Analytics for Android and iOS, and enhances the LogEvent function to accept a vector of parameters. These changes provide developers with more flexibility and convenience when logging events and managing event parameters.

Highlights

  • New Feature: Set Default Event Parameters: Introduces SetDefaultEventParameters for Android and iOS, allowing developers to set parameters that will be included with every event logged from the SDK. This simplifies the process of adding common parameters to multiple events.
  • Enhancement: LogEvent with Vector of Parameters: Enables the LogEvent function to accept a vector of parameters, providing a more flexible and convenient way to pass event parameters.
  • Integration Test: Adds a new integration test TestSetDefaultEventParameters to verify the functionality of the newly added SetDefaultEventParameters.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
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 SetDefaultEventParameters and a std::vector overload for LogEvent to the Analytics SDK. The implementations for Android, iOS, and the desktop stubs are well-structured. My review includes a few suggestions to enhance robustness and clarity: addressing a potential crash on Android by adding a null check, correcting a misleading error message on iOS, updating documentation in a public header file for accuracy, and expanding test coverage for the new functionality.

Copy link
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 SetDefaultEventParameters and adds a std::vector overload for LogEvent to the Analytics SDK. The changes are implemented for Android and iOS, with stubs for desktop platforms. The implementation is mostly correct, but I've identified a JNI local reference leak on Android, a misleading error message on iOS, and an error in the API documentation. My review includes specific suggestions to address these issues.

Copy link
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 SetDefaultEventParameters for setting default parameters for all analytics events, and adds std::vector overloads for LogEvent and SetDefaultEventParameters for convenience. The implementations for Android and iOS are included, along with stub implementations for desktop.

My review includes feedback on improving test coverage for the new vector-based APIs, correcting a misleading error message in the iOS implementation, and fixing incorrect documentation for the new LogEvent overload. Overall, the changes are well-structured and implement the intended features.

Comment on lines 301 to 311
const firebase::analytics::Parameter kDefaultParameters[] = {
firebase::analytics::Parameter("default_parameter_double", 123.456),
firebase::analytics::Parameter("default_parameter_int", 4),
firebase::analytics::Parameter("default_parameter_str", "Hello World"),
};

firebase::analytics::SetDefaultEventParameters(
kDefaultParameters,
sizeof(kDefaultParameters) / sizeof(kDefaultParameters[0]));
firebase::analytics::LogEvent("default_parameter_event");
firebase::analytics::SetDefaultEventParameters(nullptr, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This test is a good start for SetDefaultEventParameters. However, this pull request also introduces new std::vector-based overloads for both SetDefaultEventParameters and LogEvent. It would be beneficial to add tests for these new overloads to ensure they work as expected.

For example, you could modify this test to use std::vector:

  const std::vector<firebase::analytics::Parameter> kDefaultParameters = {
      firebase::analytics::Parameter("default_parameter_double", 123.456),
      firebase::analytics::Parameter("default_parameter_int", 4),
      firebase::analytics::Parameter("default_parameter_str", "Hello World"),
  };

  firebase::analytics::SetDefaultEventParameters(kDefaultParameters);
  firebase::analytics::LogEvent("default_parameter_event");
  firebase::analytics::SetDefaultEventParameters({});

@AustinBenoit AustinBenoit force-pushed the analytics/default-param branch from bc5ee73 to 9f6c0ea Compare November 4, 2025 19:54
@AustinBenoit AustinBenoit added the tests-requested: quick Trigger a quick set of integration tests. label Nov 4, 2025
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

❌  Integration test FAILED

Requested by @AustinBenoit on commit 3ff89c1
Last updated: Tue Nov 4 14:31 PST 2025
View integration test log & download artifacts

Failures Configs
missing_log [TEST] [ERROR] [iOS] [macos] [1/2 ios_device: simulator_target]
[TEST] [ERROR] [tvOS] [macos] [tvos_simulator]
analytics
(5 items)[BUILD] [ERROR] [Android] [All 3 os]
[BUILD] [ERROR] [Linux] [x64] [openssl]
[BUILD] [ERROR] [Windows] [x64] [openssl]
[BUILD] [ERROR] [iOS] [macos]
[BUILD] [ERROR] [tvOS] [macos]
app_check [TEST] [FLAKINESS] [Android] [1/3 os: macos] [1/2 android_device: android_target]
(1 failed tests)  CRASH/TIMEOUT
firestore [TEST] [FLAKINESS] [Android] [1/3 os: macos] [1/2 android_device: android_target]
(1 failed tests)  FirestoreTest.TestQuerySnapshotEventsForDelete
remote_config [TEST] [FLAKINESS] [Android] [1/3 os: ubuntu] [1/2 android_device: android_target]
(1 failed tests)  CRASH/TIMEOUT

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Nov 4, 2025
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: failed This PR's integration tests failed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant