How to implement the Userlane snippet

This article describes the steps required to implement the different parts of the Userlane snippet into your application code.

Manager task

1. Share the snippet with your developers 

Locate your Userlane snippet in the Dashboard by going to My Account > Snippet. Copy the snippet and send it to your developers. 

The snippet makes Userlane visible for your end-users. You can simply set all chapters to private or switch Userlane off in the Userlane Dashboard to ensure that none of your users sees Userlane before go-live.
⇨ Start this Guide to set chapters to private.
⇨ Start this Guide to switch off Userlane.

Developer tasks

1. Implement the basic snippet parts

The load function loads Userlane in your application. The initialize command executes Userlane and is needed for the Userlane Assistant to appear. 

// load Userlane

// identify your user (see Chapter 3. below)


// initialize Command

Userlane('init', your_property_ID);

Make sure that the initialize command contains your account’s property ID that can be found in the Userlane Dashboard Snippet. 

The initialize command executes Userlane. Therefore, all the commands you want to use additionally should be called before ‘init’.

2. Pass additional user information in your code snippet

We recommend that you pass the user ID in your snippet with the identify command so that Userlane can save the status of a user anonymously. 

// Pass the user ID without any Custom User Attributes


Additionally, you can pass Custom User Attributes within this command. This allows applying user-based segmentation in the Userlane Dashboard later. This article provides more info on how a Snippet with passed custom data attributes looks like. 

// Pass a Custom User Attribute (data types: number, string, datetime, array, boolean)


Good to know

  • You need to load and initialize Userlane to make it visible in your application. Any other commands are optional. However, we recommend passing the user ID in the identify command as well. If this command is not used Userlane will generate a random user ID and will save it in a cookie.

  • If you pass any additional commands in the snippet, make sure they are called before the initialize command. The initialize command will confirm the passed user information. Therefore, with every reload, the passed user information refresh.