Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 813 Bytes

File metadata and controls

30 lines (23 loc) · 813 Bytes
title useGetGoogleAnalyticsClientIdQuery

Retrieve the Google Analytics client ID for a Firebase Analytics instance.

Usage

import { getAnalytics } from "firebase/analytics";
import {
  analyticsQueryKeys,
  useGetGoogleAnalyticsClientIdQuery,
} from "@tanstack-query-firebase/react/analytics";

const analytics = getAnalytics(app);

const { data: clientId, isLoading } = useGetGoogleAnalyticsClientIdQuery(
  analytics,
  {
    queryKey: analyticsQueryKeys.googleAnalyticsClientId(analytics.app.name),
  },
);

Notes

  • Wraps Firebase getGoogleAnalyticsClientId.
  • Requires a caller-provided queryKey.
  • Disable the query until Analytics is initialized with enabled: !!analytics if needed.