Before you begin
This guide assumes that you have configured the Advanced Personalization feature and are familiar with user profiles.This feature isn’t available on every plan.
Refer to your pricing plan to see if it’s included.
Fetch a user profile
1
Retrieve your user's ID
Retrieve your user’s ID from where it’s stored (for example, your database).If a user ID is unavailable (possibly because the user is a first-time visitor) or doesn’t correspond to an existing user profile, you can implement a fallback to avoid adding extra logic to your app.The following example fetches the user profile and
provides a fallback if there’s a problem completing the :
JavaScript
2
Provide the user profile
Ensure the user profile is available to the rest of your app.In React, you can provide the user profile to your app as follows:
React
3
Access the user profile
After passing the user profile to the
PersonalizationProfileProvider provider,
you can access your user profile properties with the usePersonalizationProfile React Hook.
You can use this Hook in any component within PersonalizationProfileProvider.React