1. Manager task: Where to find your Userlane Snippet

You can copy your userlane Snippet from your Userlane Dashboard in the My Account - Snippet section. Copy your Snippet and send it to your engineers. 

The Snippet is going to make Userlane visible for your end users. You can simply set all Chapters to private or switch Userlane off in the Userlane Dashboard to make sure that none of your users sees Userlane before the go-live.

2. Dev task: Implementing 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
(function(i,s,o,g,r,a,m){i['UserlaneCommandObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)};a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://cdn.userlane.com/userlane.js','Userlane');

// Here between “load Userlane” and “initialize Command” you can pass additional user information (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’. 

3. Dev task: Pass additional user information in your Code Snippet. 

We recommend you to pass the user ID in your snippet with the identify command so that userlane can save the status of a user anonymously. 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)

Userlane('identify','user_ID',{
  Attribute_key:'Attribute_value'
});

If you want to pass the user’s signup time, you can use the user command.  More Info.

// Pass the user Signup Time in the User Command

Userlane('user', 'user_ID', 'YYYY-MM-DD hh:mm:ss');

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 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.   

Related Articles 

Do you need more info?

Contact us via our Intercom Chat or write us a message at support@userlane.com

Did this answer your question?