Hooks
useGroup
The useGroup()
hook enables you to add properties and send tracking events to the current group.
About this hook
The hook contains the following methods:
track(eventName: string, properties?: Record<string, unknown>)
Promise that sends tracking events for the current group
addProperties(properties: Record<string, unknown>)
Promise that adds properties to the current group
setGroupId(groupId: string, properties?: Record<string, unknown>)
Promise that sets the current group ID. Using this hook can cause unexpected behaviors if also setting the group ID at the
<Frigade.Provider />
level.Example use cases:
- Tracking events and adding properties to the current group for using with Targeting
- Wrapping the
track
method with your existing tracking/analytics methods
Example usage:
Make sure to call any Frigade hook within the context of
<Frigade.Provider />
Standardized properties
The following standardized properties are automatically added to the group object if provided via addProperties
:
name
: The name of the group/company/organiationimageUrl
: The URL of the group/company/organiation’s logo