Quick reference of commands in Userlane

About commands

Commands are useful for issuing specific instructions to cause a specific behaviour.

Various commands

Click on any header to get redirected to an article outlining the command in more depth.

Load the script

// load Userlane

Identify your user

//identify command
Userlane('identify', currentUser.id);

Identify the user and pass Custom Attributes

// identify command with custom user attributes
Userlane('identify', currentUser.id, {
  attribute_key: 'attribute_value'

Initialize Userlane

// initialize command
Userlane('init', your_property_ID);

Open the Userlane Assistant

// open the Userlane Assistant  

Hide the Userlane Assistant

// hide Userlane

// show Userlane again with initializing it
Userlane('init', your_property_ID);

Language command

// set the language of Userlane
Userlane('lang', 'language_code');

Trigger command

// Start a userlane
// TODO: replace 12345 with your userlane id
Userlane('start', 12345); 
// Start a userlane at a specific step
// TODO: replace 12345 with your userlane id
// TODO: replace 4 with the index of the step
Userlane('start', 12345, 4);
//Start a userlane only once per User
// TODO: replace 12345 with your userlane id
Userlane('startOnce', 12345);

Callback events

// hook into onStart, onComplete or onExit and provide a callback function
//TODO: Optionally replace onStart with onComplete or onExit and adjust the respective output message
Userlane('onStart', function(userlaneId, user) {

// you can put any code in here

console.log('the user started a guide');
// remove all callbacks from the onStart event
Userlane('onStart', false);
//Example user object you receive:
id: "9717166719265375",
generated: true,
time_signup: "2017-11-22T11:50:48.671Z"

User Icon

Thank you! Your comment has been submitted for approval.