← All changelogs

Merging Guest and User Sessions

Christian Mathiesen

Christian Mathiesen

Cofounder

A common use case in product onboarding is to allow a user to go through an onboarding flow before registering their account. For instance, a user might a fill out a Form or even a Checklist before they will be assigned a user ID in your own database. Without Frigade, this would typically require developers to build a custom datastore to track guest sessions, managing cookies or local storage for storing IDs, along with hundreds of lines of customized code to map data collected during the guest session to the real users database.

We're happy to share that Frigade now allows you to easily map all data and state collected from an unauthenticated user directly to their registered account with just one line of code.

Simply use the linkExistingGuestSessionToUser method in the Flows Hook as such:

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

const { linkExistingGuestSessionToUser } = useUser();

// This will merge all state from  the guest session
// to the user with the ID '1234'
linkExistingGuestSessionToUser('1234');

This feature is available in @frigade/react version 1.38.8 and above. Happy linking!

What will you build? Get started today.