Updating the user ID

User IDs are important for Frigade to keep track of your users. If you don’t provide a user ID, Frigade will generate a guest user id for you. User IDs can be provided at time of render in the <FrigadeProvider> component or at any time using the setUserId method:

import { useUser } from '@frigade/react';

const { setUserId } = useUser();

setUserId('1234');

If you want to set properties in the same call, you can do so by using the setUserIdWithProperties method:

import { useUser } from '@frigade/react';

const { setUserIdWithProperties } = useUser();

setUserIdWithProperties('1234', {
  name: 'Christian Mathiesen',
  email: 'chris@frigade.com'
});

Adding user properties

import { useUser } from '@frigade/react';

const { addPropertiesToUser } = useUser();

addPropertiesToUser({
  name: 'Christian Mathiesen',
  email: 'christian@frigade.com'
});

Tracking events for the user

import { useUser } from '@frigade/react';

const { trackEventForUser } = useUser();

trackEventForUser('user-registered', {
  name: 'Christian Mathiesen'
});

Standardized fields

When setting user properties, Frigade automatically detects and stores the following fields on the user:

  • firstName
  • lastName
  • email
  • organization