Skip to content

feat(react): add Firebase Analytics hooks with tests#234

Open
Ehesp wants to merge 4 commits into
mainfrom
cursor/react-analytics-hooks
Open

feat(react): add Firebase Analytics hooks with tests#234
Ehesp wants to merge 4 commits into
mainfrom
cursor/react-analytics-hooks

Conversation

@Ehesp
Copy link
Copy Markdown
Member

@Ehesp Ehesp commented May 26, 2026

Implement Analytics query and mutation hooks aligned with Firestore DX, wire the module for build/export, and add full test coverage.

Implement Analytics query and mutation hooks aligned with Firestore DX,
wire the module for build/export, and add full test coverage.
@docs-page
Copy link
Copy Markdown

docs-page Bot commented May 26, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/invertase/tanstack-query-firebase~234

Documentation is deployed and generated using docs.page.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

⚠️ No Changeset found

Latest commit: c874a99

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Ehesp added 3 commits May 27, 2026 09:04
Resolve tsup.config.ts conflict by including both analytics and database packages.
Document analytics hooks and add sidebar navigation for the new module.
@Ehesp Ehesp marked this pull request as ready for review May 27, 2026 08:09
Copilot AI review requested due to automatic review settings May 27, 2026 08:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds React hooks for Firebase Analytics, exports the new analytics subpath, and documents the new API surface alongside tests.

Changes:

  • Adds Analytics query/mutation hooks for support checks, client ID reads, event logging, consent, collection settings, screen, user ID, and user properties.
  • Adds query key helpers, shared Analytics hook option/variable types, and Vitest coverage.
  • Wires the analytics package export/build entry and adds documentation/navigation pages.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react/tsup.config.ts Adds Analytics to package build entries.
packages/react/package.json Exposes ./analytics subpath.
packages/react/src/analytics/index.ts Exports Analytics hooks and query keys.
packages/react/src/analytics/types.ts Defines shared Analytics hook option and variable types.
packages/react/src/analytics/queryKeys.ts Adds Analytics query key helpers.
packages/react/src/analytics/queryKeys.test.ts Tests Analytics query key output.
packages/react/src/analytics/useGetGoogleAnalyticsClientIdQuery.ts Adds client ID query hook.
packages/react/src/analytics/useGetGoogleAnalyticsClientIdQuery.test.tsx Tests client ID query behavior.
packages/react/src/analytics/useIsSupportedQuery.ts Adds Analytics support query hook.
packages/react/src/analytics/useIsSupportedQuery.test.tsx Tests support query behavior.
packages/react/src/analytics/useLogEventMutation.ts Adds event logging mutation hook.
packages/react/src/analytics/useLogEventMutation.test.tsx Tests event logging mutation behavior.
packages/react/src/analytics/useSetAnalyticsCollectionEnabledMutation.ts Adds collection enabled mutation hook.
packages/react/src/analytics/useSetAnalyticsCollectionEnabledMutation.test.tsx Tests collection enabled mutation behavior.
packages/react/src/analytics/useSetConsentMutation.ts Adds consent mutation hook.
packages/react/src/analytics/useSetConsentMutation.test.tsx Tests consent mutation behavior.
packages/react/src/analytics/useSetCurrentScreenMutation.ts Adds deprecated current screen mutation hook.
packages/react/src/analytics/useSetCurrentScreenMutation.test.tsx Tests current screen mutation behavior.
packages/react/src/analytics/useSetDefaultEventParametersMutation.ts Adds default event parameters mutation hook.
packages/react/src/analytics/useSetDefaultEventParametersMutation.test.tsx Tests default event parameters mutation behavior.
packages/react/src/analytics/useSetUserIdMutation.ts Adds user ID mutation hook.
packages/react/src/analytics/useSetUserIdMutation.test.tsx Tests user ID mutation behavior.
packages/react/src/analytics/useSetUserPropertiesMutation.ts Adds user properties mutation hook.
packages/react/src/analytics/useSetUserPropertiesMutation.test.tsx Tests user properties mutation behavior.
docs/react/index.mdx Links Analytics docs from React overview.
docs/react/analytics/index.mdx Adds Analytics getting started documentation.
docs/react/analytics/hooks/useGetGoogleAnalyticsClientIdQuery.mdx Documents client ID query hook.
docs/react/analytics/hooks/useIsSupportedQuery.mdx Documents support query hook.
docs/react/analytics/hooks/useLogEventMutation.mdx Documents event logging mutation hook.
docs/react/analytics/hooks/useSetAnalyticsCollectionEnabledMutation.mdx Documents collection enabled mutation hook.
docs/react/analytics/hooks/useSetConsentMutation.mdx Documents consent mutation hook.
docs/react/analytics/hooks/useSetCurrentScreenMutation.mdx Documents current screen mutation hook.
docs/react/analytics/hooks/useSetDefaultEventParametersMutation.mdx Documents default event parameters mutation hook.
docs/react/analytics/hooks/useSetUserIdMutation.mdx Documents user ID mutation hook.
docs/react/analytics/hooks/useSetUserPropertiesMutation.mdx Documents user properties mutation hook.
docs.json Adds Analytics docs navigation entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { getAnalytics } from "firebase/analytics";

// Initialize your Firebase app
initializeApp({ ... });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants