Installation
userpilotSettings Object
key | Description | Example |
---|---|---|
token | Account App Token | NX-98ii14b |
version | Pinned SDK Version | 1.730 |
endpoint | API endpoint for when proxying | api.example.com/socket |
domain | JS SDK domain for CNAME | js.example.com |
auto_props | Collecting auto properties | true | false |
pageview | Specifies what to collect from a URL | pathonly | withhash | fullurl |
sri | Sub Resource Integrity value | sha384-AivuiHqNxK7LKiAbFB+8god8cikUQmzAkyuJkIMleqa9QlGx1sUKFf6kzfskDqs7 |
Getting Started
To use the SDK, ensure it is loaded on your page. Then, you can call the available methods on theuserpilot
object.
Methods
identify(userId, [properties])
Identifies the current user with an ID and optional properties.anonymous()
Assigns a session-based unique ID for the current user on public pages.reload([options])
Updates Userpilot content when the page state changes.track(name, [properties])
Tracks a custom event for the current user.trigger(contentId)
Forces a specific Userpilot content to show for the current user.on(event, callback)
Registers a callback for a Userpilot event.Event Examples
off(event)
Removes a callback function attached to an event.once(event, callback)
Registers a callback to be triggered only once.end()
Ends the currently running flow.clean()
Clears Userpilot storage and session data.destroy()
Fully clears Userpilot storage and removes all active content.suppress()
Fully stops Userpilot operations on the SDK side.unsuppress()
Resumes SDK operations.Parameters
Method | Parameters | Description |
---|---|---|
identify | userId, properties? | Identify a user and set properties |
anonymous | Assign a session-based ID | |
reload | options? | Reload Userpilot content |
track | name, properties? | Track a custom event |
trigger | contentId | Show specific content |
on | event, callback | Listen for Userpilot events |
off | event | Remove event listener |
once | event, callback | Listen for event once |
end | End the current flow | |
clean | Clear Userpilot storage | |
destroy | Remove all Userpilot data and content |