Skip to content

Conversation

@conroy-ricketts
Copy link
Contributor

@conroy-ricketts conroy-ricketts commented Dec 18, 2025

CCCT-1952

Technical Summary

I added the connect server to the user properties for all firebase analytics events. Here are the name-value pairs that will now appear for all events:

  • connect_server -> connect.dimagi.com
  • connect_server -> connect-staging.dimagi.com

Edit: I updated the name-value pairs to the following:

  • app_flavor -> commcare
  • app_flavor -> cccStaging

Safety Assurance

Safety story

I went into BigQuery and ran a query to verify that this new user property does show for my test device, and I tested with both a staging and a prod build.

Added the connect server to the user properties for all firebase analytics events.
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

The PR introduces a new Firebase analytics user property CONNECT_SERVER to track the Connect Server host. A constant CONNECT_SERVER with value "connect_server" is added to CCAnalyticsParam, and the corresponding Firebase user property is set in setUserProperties method with the value from BuildConfig.CCC_HOST.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

The changes are straightforward: a single constant addition and a single property assignment across two files with no complex logic or behavioral modifications.

Possibly related PRs

Suggested labels

skip-integration-tests

Suggested reviewers

  • OrangeAndGreen
  • shubham1g5
  • Jignesh-dimagi

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ⚠️ Warning PR description lacks required sections including Product Description, Feature Flag, Automated test coverage, QA Plan, and Labels/Review checklist. Add missing sections: Product Description (visible changes), Feature Flag (if applicable), Automated test coverage (related tests), QA Plan (with QA ticket link), and complete the Labels and Review checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new Firebase Analytics property for tracking the connect server.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/CCCT-1952-new-firebase-analytics-property

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java (1)

128-129: Set CONNECT_SERVER property using BuildConfig.CCC_HOST.

The code correctly sets the user property with the compile-time constant. BuildConfig.CCC_HOST is defined in build.gradle and will always have a value, so a null/empty check is unnecessary. Unlike runtime values like domain and serverName which legitimately require TextUtils.isEmpty() guards, BuildConfig fields are never null.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad63f07 and 24d9a03.

📒 Files selected for processing (2)
  • app/src/org/commcare/google/services/analytics/CCAnalyticsParam.java (1 hunks)
  • app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: shubham1g5
Repo: dimagi/commcare-android PR: 0
File: :0-0
Timestamp: 2025-05-08T11:08:18.530Z
Learning: PR #3048 "Phase 4 Connect PR" introduces a substantial feature called "Connect" to the CommCare Android app, which includes messaging, job management, delivery tracking, payment processing, authentication flows, and learning modules. It follows a modern architecture using Navigation Components with three navigation graphs, segregated business logic in Manager classes, and proper database persistence.
🧬 Code graph analysis (1)
app/src/org/commcare/google/services/analytics/FirebaseAnalyticsUtil.java (1)
app/src/org/commcare/google/services/analytics/CCAnalyticsParam.java (1)
  • CCAnalyticsParam (7-52)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Lint Code Base
🔇 Additional comments (1)
app/src/org/commcare/google/services/analytics/CCAnalyticsParam.java (1)

51-51: LGTM!

The constant declaration follows the established pattern and naming conventions in this file.


flagPersonalIDDemoUser(ReportingUtils.getIsPersonalIDDemoUser());

analyticsInstance.setUserProperty(CCAnalyticsParam.CONNECT_SERVER, BuildConfig.CCC_HOST);
Copy link
Contributor

@OrangeAndGreen OrangeAndGreen Dec 18, 2025

Choose a reason for hiding this comment

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

A question mostly for @shubham1g5: Do we only want to set this when the PersonalID user is logged in? Not sure if there's any harm in always logging it, other than maybe some extra storage costs in BigQuery.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be fine, probably the most damage this user property is causing is it's consuming our quota of 25 user properties, I am curious if we don't already get the app flavor info in big query with events or in some other way ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, that sounds good to me. Unfortunately I don't think the app flavor gets logged with analytics. I just double-checked the definitions for the analytics tables, and did a quick query on the app_info subsection specifically to verify it isn't included there

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm ok, I think we are better off in that case is to log a flavor here instead -

FirebaseAnalytics.getInstance(context)
    .setUserProperty("app_flavor", BuildConfig.FLAVOR)

We can use this to filter our connect staging but also won't need another user property in case we need to send flavor for some other purpose in future.

Copy link
Contributor

@OrangeAndGreen OrangeAndGreen Dec 18, 2025

Choose a reason for hiding this comment

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

Yeah, I like that idea

Copy link
Contributor

@shubham1g5 shubham1g5 Dec 19, 2025

Choose a reason for hiding this comment

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

yeah that's a good idea too, I think we would want to still see the crashes but agree that for analytics it feels best to skip these events on staging.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a slight preference to keeping it for the following reasons:

  • Now that we're cleaning up analytics older than 90 days I don't think storage costs are a big issue
  • Leaving these events for staging would still be helpful for us to test them out (like testing that a new event is being logged correctly)

That being said, I'm also okay with skipping them. Do we know if QA still uses the cccStaging flavor when testing? They used to but in recent releases I think we've only been giving them prod builds...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with going either way too - I can see the pros of taking either route

Copy link
Contributor

Choose a reason for hiding this comment

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

lets go ahead with the current solution then.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for testing new events for stagging @OrangeAndGreen.

OrangeAndGreen
OrangeAndGreen previously approved these changes Dec 18, 2025
…nto bug/CCCT-1952-new-firebase-analytics-property
Logged app flavor instead of connect server.
@conroy-ricketts conroy-ricketts merged commit fa40cc1 into master Dec 19, 2025
7 checks passed
@conroy-ricketts conroy-ricketts deleted the bug/CCCT-1952-new-firebase-analytics-property branch December 19, 2025 21:45
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.

5 participants