Skip to main content
Every export on this page comes from @grainql/analytics-web/react. Every hook must run inside a GrainProvider. Read React hooks for the setup and for when to use Grain Tag instead.

GrainProvider

Pass config or client, not both.

useGrainAnalytics

The hook has no parameters. It returns the client of the nearest GrainProvider. Use it for identify, setProperty, the template methods, flush, and consent.

useConfig

The component re-renders when the value of key changes.

useAllConfigs

The component re-renders when any value changes.

useTrack

The hook has no parameters. The returned function keeps the same reference across renders, so it is safe as a prop and does not need useCallback.

useConsent

The hook has no parameters.

usePrivacyPreferences

The hook has no parameters.

useDataDeletion

The hook sends the request. The deletion runs on the server. Read Privacy and consent.

ConsentBanner

PrivacyPreferenceCenter

CookieNotice