useSetConsentMutation
Set end-user consent state for Google Analytics across all gtag references on the page.
Usage
import { useSetConsentMutation } from "@tanstack-query-firebase/react/analytics";
const { mutate: setAnalyticsConsent } = useSetConsentMutation();
setAnalyticsConsent({
analytics_storage: "granted",
ad_storage: "denied",
});
Notes
- Wraps Firebase
setConsent. - This is a module-level API and does not require an
Analyticsinstance.