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: !!analyticsif needed.