Organization Hook
Frigade allows you to group users together in organizations. This is especially useful for building Targeting rules based on actions that only needed to be completed once across an entire organization (e.g. connect an organization’s bank account). Once you set an organization ID for a user, they will automatically be added to that organization in Frigade.
Updating the organization ID
Organization IDs are important for Frigade to keep track of your organization. If you don’t provide a organization ID, Frigade will generate a guest organization id for you.
Organization IDs can be provided at time of render in the <FrigadeProvider>
component or at any time using the setOrganizationId
method:
import { useOrganization } from '@frigade/react';
const { setOrganizationId } = useOrganization();
setOrganizationId('1234');
If you want to set organization’s properties in the same call, you can do so by using the setOrganizationIdWithProperties
method:
import { useOrganization } from '@frigade/react';
const { setOrganizationIdWithProperties } = useOrganization();
setOrganizationIdWithProperties('1234', {
name: 'Acme Inc.',
logo: 'https://acme.com/logo.png'
});
Adding custom organization properties
import { useOrganization } from '@frigade/react';
const { addPropertiesToOrganization } = useOrganization();
addPropertiesToOrganization({
name: 'Acme Inc.',
logo: 'https://acme.com/logo.png'
});
Tracking events for the organization
import { useOrganization } from '@frigade/react';
const { trackEventForOrganization } = useOrganization();
trackEventForOrganization('bank-account-connected', {
provider: 'Bank of America'
});
Standardized fields
When setting organization properties, Frigade automatically detects and stores the following fields on the organization:
logo
- a url for a company logoname
- the name of the organization