1
Step 1: Install JavaScript Snippet
Copy the snippet and paste it at the beginning of your
<head>
section in your index.html file on every page you want to use Userpilot.Your App Token can be found under the environment tab.You can include the staging token on staging environments
2
Step 2: Identify Users
The user ID (a unique identifier) is required. Additional user and company properties can also be included in the script.
- Multi-page Applications
userpilot.identify()
call is used on each page to identify the user and determine if they should see Userpilot content. - Single page Applications
localStorage.get("token")
is an example method of authentication.3
Step 3: Reload Userpilot on Page Change
This step is only required for SPAs
4
Step 4: Sending Tracked Events
Sending coded events to Userpilot is recommended to utilize the events in reports, in-app triggering, and segmenting users.Use the
userpilot.track()
call to track actions users take in your application.If you use an analytics tool (e.g. Mixpanel, Amplitude, Hotjar, FullStory, Google Analytics) add theuserpilot.track()
wherever you’re already tracking events. You can also pass extra metadata alongside the event’s name to pass unique information about the event.For more advanced customizations and detailed API reference, check out our JavaScript SDK documentation.