Understand the difference between userpilot.identify and userpilot.reload, and when to use each.
userpilot.identify
and userpilot.reload
. Understanding when and how to use each is essential for accurate user tracking and seamless content delivery, especially in modern web applications and Single Page Apps (SPAs).
userpilot.identify
function is used to uniquely identify a user and set their properties. This is typically called on the first page load after authentication, but can also be called whenever user properties change.
When to use:
identify
again with the new property:
You can call userpilot.identify
multiple times on the same page as user properties change.
userpilot.reload
function refreshes Userpilot content based on the current page state or URL. This is especially important in Single Page Applications (SPAs), where the URL or page content can change without a full page reload.
When to use:
userpilot.identify
(never before).
Note: Calling userpilot.reload
before identifying the user will have no effect. Always ensure the user is identified first.
Function | When to Use | Example Use Case |
---|---|---|
userpilot.identify | On first load after login, or when user properties change | User logs in, updates profile info |
userpilot.reload | After identify, on SPA route changes, or to refresh Userpilot UI | User navigates to a new page in an SPA |