Skip to content

GA4 tracking, platform (windows vs linux) and framework.#10003

Merged
christhompsongoogle merged 7 commits into
mainfrom
tracking
Mar 9, 2026
Merged

GA4 tracking, platform (windows vs linux) and framework.#10003
christhompsongoogle merged 7 commits into
mainfrom
tracking

Conversation

@christhompsongoogle
Copy link
Copy Markdown
Contributor

GA4 tracking, platform (windows vs linux) and framework.

@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 enhances the Firebase Studio migration utility by incorporating GA4 tracking to gather insights into usage patterns. It introduces a critical platform check that disallows migration on Windows operating systems, providing a clear error message to users. Additionally, the changes include an automatic detection mechanism for common application frameworks, which is then used in the GA4 tracking data to provide more granular telemetry.

Highlights

  • GA4 Tracking Integration: Integrated GA4 tracking for the Firebase Studio migration process, capturing platform and detected application framework.
  • Platform-Specific Migration Handling: Implemented a check to prevent Firebase Studio migration on Windows, throwing an error and tracking the platform if attempted.
  • Automatic Application Framework Detection: Added functionality to automatically detect the application framework (Next.js, Flutter, Angular, or Other) during migration for improved telemetry.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/firebase_studio/migrate.spec.ts
    • Added imports for track and FirebaseError.
    • Introduced a new test case to verify that migration on Windows throws a FirebaseError and correctly tracks the 'windows' platform via GA4.
    • Modified an existing test case to explicitly set the platform to 'darwin' and assert that GA4 tracking is called with the detected app_type and 'linux/mac' platform.
  • src/firebase_studio/migrate.ts
    • Imported trackGA4 for analytics.
    • Implemented a new asynchronous function detectAppType to identify the project's framework (Next.js, Flutter, Angular, or Other) by checking for specific files and package.json dependencies.
    • Added a conditional check at the beginning of the migrate function to determine the operating system. If process.platform is 'win32', it tracks the 'windows' platform and throws a FirebaseError.
    • Integrated detectAppType into the migrate function to determine the application type and subsequently track both the app_type and platform using trackGA4.
  • src/track.ts
    • Extended the cliEventNames type to include firebase_studio_migrate, enabling this specific event to be tracked via GA4.
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
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 GA4 tracking for the firebase_studio_migrate command to gather insights on platform usage and detected application frameworks. It also correctly blocks execution on Windows, which is an unsupported platform for this feature, and throws a FirebaseError as per the repository's best practices. The changes are well-implemented and include corresponding unit tests for both the success and failure scenarios. I have one suggestion to improve the code's maintainability.

Comment thread src/firebase_studio/migrate.ts Outdated
Comment on lines +66 to +77
try {
await fs.access(path.join(rootPath, "next.config.js"));
return "NEXT_JS";
} catch {
// Not Next.js
}
try {
await fs.access(path.join(rootPath, "next.config.mjs"));
return "NEXT_JS";
} catch {
// Not Next.js
}
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.

medium

To improve maintainability and reduce code duplication, you can combine the checks for next.config.js and next.config.mjs into a single loop. This aligns with the style guide's principle of keeping code concise and readable.

  // Check for Next.js config files
  for (const configFile of ["next.config.js", "next.config.mjs"]) {
    try {
      await fs.access(path.join(rootPath, configFile));
      return "NEXT_JS";
    } catch {
      // Not this config file, try the next one.
    }
  }
References
  1. The repository style guide (GEMINI.md, lines 33-34) emphasizes reducing nesting and creating clear code. Combining these repetitive checks improves readability and maintainability, which aligns with the spirit of this best practice. (link)

Copy link
Copy Markdown
Member

@joehan joehan left a comment

Choose a reason for hiding this comment

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

Mostly LGTM with one note about promises

Comment thread src/firebase_studio/migrate.ts Outdated

await askToOpenAntigravity(rootPath, appName, options.noStartAgy);

void track.trackGA4("firebase_studio_migrate", { app_type: appType, result: "success" });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe move this before askToOpenAgy to make sure that it doesn't get cut off by the process ending? Or, to be safe, just await it.

Copy link
Copy Markdown
Contributor Author

@christhompsongoogle christhompsongoogle Mar 9, 2026

Choose a reason for hiding this comment

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

Good idea, that

@christhompsongoogle christhompsongoogle enabled auto-merge (squash) March 9, 2026 22:03
@christhompsongoogle christhompsongoogle merged commit bd4d195 into main Mar 9, 2026
47 checks passed
@christhompsongoogle christhompsongoogle deleted the tracking branch March 9, 2026 22:13
andrewbrook pushed a commit that referenced this pull request Mar 25, 2026
* GA4 tracking with framework.
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.

3 participants