Google oauth#

Google OAuth integration for connecting Google Analytics.

Provider required

All hooks require a BrandwaveProvider ancestor in your component tree. See the React Hooks overview for setup instructions.

useConnectGoogleAnalytics#

Generate a Google OAuth authorization URL for connecting Google Analytics.

Owner only
typescript
import { useConnectGoogleAnalytics } from '@brandwave/react';

const { mutate, isPending } = useConnectGoogleAnalytics();

mutate({
  organizationId: 'org_123',
});

Parameters#

NameTypeRequiredDescription
organizationIdstring (UUID)RequiredOrganization identifier.
redirectPathstringPath to redirect to after OAuth (max 500 characters).

Response#

Returns { data } with the result.

Underlying SDK method: bw.google.connect(params)

useSelectGoogleAnalyticsProperty#

Select a Google Analytics property for the organization.

Owner only
typescript
import { useSelectGoogleAnalyticsProperty } from '@brandwave/react';

const { mutate, isPending } = useSelectGoogleAnalyticsProperty();

mutate({
  organizationId: 'org_123',
  propertyId: '...',
});

Parameters#

NameTypeRequiredDescription
organizationIdstring (UUID)RequiredOrganization identifier.
propertyIdstringRequiredGA4 property identifier to connect (max 64 characters).

Response#

Returns { data } with the result.

Underlying SDK method: bw.google.selectProperty(params)

useDisconnectGoogleAnalytics#

Disconnect Google OAuth and remove stored tokens.

Owner only
typescript
import { useDisconnectGoogleAnalytics } from '@brandwave/react';

const { mutate, isPending } = useDisconnectGoogleAnalytics();

mutate({
  organizationId: 'org_123',
});

Parameters#

NameTypeRequiredDescription
organizationIdstring (UUID)RequiredOrganization identifier.

Response#

Returns { data } with the result.

Underlying SDK method: bw.google.disconnect(params)