--- title: "Userflow.js Reference: the main methods and where to find every method" slug: "userflowjs-reference" updated: 2026-10-26T16:17:00Z published: 2026-10-26T16:17:00Z canonical: "help.userflow.com/userflowjs-reference" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.userflow.com/llms.txt > Use this file to discover all available pages before exploring further. # Userflow.js Reference: the main methods and where to find every method Userflow.js is the JavaScript library you install in your web app so Userflow can identify your users and show them flows, checklists and other content. This page explains the Userflow.js methods teams use most. Every method, with its parameters and code samples, is in the [full Userflow.js reference](https://docs.userflow.com/docs/userflow-js). To install Userflow.js, see [Userflow.js Installation](https://help.userflow.com/docs/userflowjs-installation). ## Which Userflow.js methods does every install need? Most Userflow.js installs call these methods on every page load, in this order: 1. [`userflow.init(token)`](https://docs.userflow.com/docs/userflow-js#init) connects Userflow.js to your Userflow environment. Find the token under Settings → Environments. Each environment, such as Production and Staging, has its own token. 2. [`userflow.identify(userId, attributes)`](https://docs.userflow.com/docs/userflow-js#identify) tells Userflow who the signed-in user is. Call it on every page load where a user is signed in. Attributes you send are added to the user's existing attributes. 3. [`userflow.group(groupId, attributes)`](https://docs.userflow.com/docs/userflow-js#group) links the user to a company or group, if you use groups. Whether groups are available depends on your plan. To record something a user did, call [`userflow.track(eventName, attributes)`](https://docs.userflow.com/docs/userflow-js#track) after `identify`. ## How do I send user attributes with Userflow.js? Userflow.js sends attributes as an object in `identify`, `updateUser`, `group` and `track`. Use [`userflow.updateUser(attributes)`](https://docs.userflow.com/docs/userflow-js#updateuser) to change attributes after `identify` without identifying the user again. Setting an attribute to `null` removes it. Attribute names can use letters, numbers, underscores, dashes and spaces. The [Attributes section of the reference](https://docs.userflow.com/docs/userflow-js#attributes) covers data types and operations like adding to a number or a list. ## How do I show Userflow to visitors who aren't signed in? Userflow.js can identify visitors who aren't signed in with [`userflow.identifyAnonymous()`](https://docs.userflow.com/docs/userflow-js#identifyanonymous). It gives the visitor an ID that's stored in their browser and reused on later visits. Use it only for visitors who aren't signed in. Each anonymous visitor counts toward your monthly active users. See [How Userflow Tracks and Bills Monthly Active Users (MAUs)](https://help.userflow.com/docs/how-userflow-tracks-and-bills-monthly-active-users-maus). ## What should Userflow.js do when a user signs out? Call [`userflow.reset()`](https://docs.userflow.com/docs/userflow-js#reset) when a user signs out of your app. Userflow.js forgets the current user and hides any content that's showing. ## How do I start or end a flow from my own code? Userflow.js can start content from your app's code with [`userflow.start(contentId)`](https://docs.userflow.com/docs/userflow-js#start). Find the content ID on the content's Link/Embed tab. Add `{once: true}` to start it only if the user hasn't seen it before. To hide all content that's showing, call [`userflow.endAll()`](https://docs.userflow.com/docs/userflow-js#endall). ## How do I control the Resource Center from Userflow.js? Userflow.js can open, close and toggle the Resource Center with [`openResourceCenter()`](https://docs.userflow.com/docs/userflow-js#openresourcecenter), [`closeResourceCenter()`](https://docs.userflow.com/docs/userflow-js#closeresourcecenter) and [`toggleResourceCenter()`](https://docs.userflow.com/docs/userflow-js#toggleresourcecenter). To use your own button instead of the default Resource Center launcher, call [`setResourceCenterLauncherHidden(true)`](https://docs.userflow.com/docs/userflow-js#setresourcecenterlauncherhidden) after `init`, and use [`getResourceCenterState()`](https://docs.userflow.com/docs/userflow-js#getresourcecenterstate) to show counts like unread announcements. See [Resource Center](https://help.userflow.com/docs/resource-center). ## Which Userflow.js settings fix common app-specific problems? Userflow.js has settings for apps that need different behavior: - **Single-page apps:** [`setCustomNavigate()`](https://docs.userflow.com/docs/userflow-js#setcustomnavigate) makes Go to page actions use your app's router instead of a full page load. - **Content showing behind your app's modals:** [`setBaseZIndex()`](https://docs.userflow.com/docs/userflow-js#setbasezindex) raises the z-index Userflow places its content at. - **Sensitive data in URLs:** [`setUrlFilter()`](https://docs.userflow.com/docs/userflow-js#seturlfilter) removes parts of the URL before it's sent to Userflow. - **Elements not found after a deploy:** the inference filters stop Userflow.js from relying on class names or IDs that change. See [Element inference: keep Userflow finding elements when class names or IDs change](https://help.userflow.com/docs/element-inference-and-dynamic-class-names). - **Custom dropdowns or combo boxes:** [`registerCustomInput()`](https://docs.userflow.com/docs/userflow-js#registercustominput) lets conditions read them like text inputs. - **Page view events:** [`setPageTrackingDisabled(true)`](https://docs.userflow.com/docs/userflow-js#setpagetrackingdisabled) stops automatic `page_viewed` events. - **Security:** [`disableEvalJs()`](https://docs.userflow.com/docs/userflow-js#disableevaljs) blocks Evaluate JavaScript actions. - **Load failures:** [`load()`](https://docs.userflow.com/docs/userflow-js#load) lets you catch errors when Userflow.js can't load, for example because of a Content Security Policy. See [Content Security Policy](https://help.userflow.com/docs/content-security-policy). ## Related articles - [Userflow.js Installation](https://help.userflow.com/docs/userflowjs-installation) - [Userflow API Reference](https://help.userflow.com/docs/userflow-api-reference) - [Identity verification](https://help.userflow.com/docs/identity-verification) - [Element inference: keep Userflow finding elements when class names or IDs change](https://help.userflow.com/docs/element-inference-and-dynamic-class-names)