Skip to content

feat(stage-*): track provider card clicks and time-to-first-message#832

Merged
nekomeowww merged 17 commits into
mainfrom
sr/analytics
Dec 27, 2025
Merged

feat(stage-*): track provider card clicks and time-to-first-message#832
nekomeowww merged 17 commits into
mainfrom
sr/analytics

Conversation

@shinohara-rin
Copy link
Copy Markdown
Contributor

@shinohara-rin shinohara-rin commented Dec 26, 2025

track provider card clicks and time-to-first-message

introduces new events: provider_card_clicked, first_message_sent

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shinohara-rin, 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 significantly enhances the application's analytics capabilities by introducing a centralized analytics store and integrating PostHog for tracking key user interactions. It establishes a robust framework for collecting build-related metadata and user behavior, specifically focusing on how users engage with service providers and their initial interaction with the chat functionality. This refactor aims to provide deeper insights into user experience and application performance without affecting core functionalities.

Highlights

  • Analytics Refactor: Introduced a new shared Pinia store (useSharedAnalyticsStore) to centralize analytics state and build information across the application. This store manages application start time, build details (version, commit, branch, build time), and tracks whether the first message has been sent.
  • PostHog Integration: Refactored PostHog initialization to leverage the new analytics store for registering application metadata. This ensures consistent and centralized reporting of build-related information to PostHog.
  • Provider Card Click Tracking: Implemented tracking for clicks on provider cards across various settings pages (Consciousness, Hearing, Speech, and the main Providers index). This allows for insights into user engagement with different service providers.
  • Time-to-First-Message Tracking: Added functionality to track the 'time-to-first-message' in the chat store. This metric captures the duration from application start to the user's first message, providing valuable data on initial user interaction and potential onboarding friction.
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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 26, 2025

⏳ Approval required for deploying to Cloudflare Workers (Preview) for stage-web.

Name Link
🔭 Waiting for approval For maintainers, approve here

Hey, @nekomeowww, @sumimakito, @luoling8192, @LemonNekoGH, kindly take some time to review and approve this deployment when you are available. Thank you! 🙏

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 analytics tracking for provider card clicks and time-to-first-message using PostHog. It also includes a significant and beneficial refactoring to centralize analytics logic into a shared store and composable, which improves maintainability by decoupling components from build-time information.

I've found a critical issue in both stage-web and stage-tamagotchi applications where useAnalytics() is called before the Pinia store is initialized, which will cause the applications to crash on startup. I've provided a detailed fix for this. Additionally, I've suggested a small improvement to make the version tracking logic more robust.

Overall, the changes are well-structured and the new features are implemented correctly, pending the fix for the initialization issue.

Comment thread apps/stage-tamagotchi/src/renderer/main.ts Outdated
Comment thread apps/stage-web/src/main.ts Outdated
Comment thread packages/stage-ui/src/stores/analytics/index.ts Outdated
shinohara-rin and others added 2 commits December 26, 2025 22:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…adata registration to mitigate potential race condition
@shinohara-rin shinohara-rin self-assigned this Dec 26, 2025
@shinohara-rin
Copy link
Copy Markdown
Contributor Author

/gemini review

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 analytics for tracking provider card clicks and the time to the first message, which is a valuable addition for understanding user behavior. The refactoring of analytics initialization into a shared Pinia store is a significant improvement for maintainability and consistency across the applications. The implementation is solid and well-executed. I've included a couple of minor suggestions to further enhance the encapsulation and simplify the API of the new analytics store.

Comment thread packages/stage-ui/src/stores/analytics/index.ts Outdated
Comment thread packages/stage-ui/src/stores/analytics/index.ts Outdated
@shinohara-rin shinohara-rin marked this pull request as ready for review December 26, 2025 15:21
@nekomeowww nekomeowww changed the title feat(stage-ui,stage-web,stage-pages,stage-tamagotchi) track provider card clicks and time-to-first-message w/ postHog refactor feat(stage-ui,stage-web,stage-pages,stage-tamagotchi) track provider card clicks and time-to-first-message & Posthog refactor Dec 26, 2025
@shinohara-rin
Copy link
Copy Markdown
Contributor Author

ooops i didn't meant to push that

@nekomeowww nekomeowww changed the title feat(stage-ui,stage-web,stage-pages,stage-tamagotchi) track provider card clicks and time-to-first-message & Posthog refactor feat(stage-*): track provider card clicks and time-to-first-message Dec 27, 2025
Comment on lines +45 to +53
// Initialize analytics
const analyticsStore = useSharedAnalyticsStore(pinia)
analyticsStore.initialize({
version: version ?? 'dev',
commit: abbreviatedSha,
branch,
builtOn: buildTime.toISOString(),
})

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.

We should initialize in App.vue.

Comment on lines +33 to +42

// Initialize analytics
const analyticsStore = useSharedAnalyticsStore(pinia)
analyticsStore.initialize({
version: version ?? 'dev',
commit: abbreviatedSha,
branch,
builtOn: buildTime.toISOString(),
})

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.

We should initialize in App.vue.

Comment thread packages/stage-ui/src/stores/analytics/index.ts Outdated
Comment thread packages/stage-pages/src/pages/settings/modules/speech.vue Outdated
Comment thread packages/stage-pages/src/pages/settings/modules/consciousness.vue Outdated
Comment thread apps/stage-web/src/main.ts Outdated
Comment thread apps/stage-tamagotchi/src/renderer/main.ts Outdated
@nekomeowww nekomeowww merged commit ca6a0b2 into main Dec 27, 2025
4 of 9 checks passed
@nekomeowww nekomeowww deleted the sr/analytics branch December 27, 2025 08:46
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