Custom data are fields that you can add as user attributes to your user profiles. They can be filled with data. This data will help you to build better user segments that allow you to target specific user groups.

Before you proceed, make sure you’ve already planned and created all custom data fields that you will need.

The JS snippet

Userlane is loaded up via a JS snippet already. This JS snippet is the foundation. You can amend the JS snippet of Userlane to save data in the user profile of the current user. This happens with the identfity command in the snippet:

Userlane('identify',, {
  attribute_key: 'attribute_value'

This is an example snippet with everything necessary:

// 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','','Userlane');

// TODO: the command below is just for illustration purposes
// it's definition must be changed to work for your application
var currentUser = please_replace_this_with_your_api_call.getCurrentUser(); // returns an object with id and other data of the current user who’s using the application in this moment

// identify the user for Userlane
Userlane('identify',, {

  // TODO: these fields below are defined by you.
  // Below are just examples. You must individually customize
  // your own attributes and variables here.
  permissions: currentUser.permissions

// initialize Userlane with your account ID, in this example it is “12345”
Userlane('init', 12345);

Your individual JS Snippet

You will find an example tailored to your setup in your Dashboard.

Custom field data types

Every custom field has a data type. It can only accept data that fits this type. These types are defined when the custom data field is first created and can not be changed afterwards.

Here is a list of which data types Userlane can work with:

  1. True/false: Custom true/false fields accept JavaScript booleans. We also parse values like 1, 0, “yes” and “no” to their respective true/false value.

  2. Text: Custom text fields accepts JavaScript strings. There is no length limit on individual strings but all custom data may not exceed the size of 500kb.

  3. Number: Custom number fields accept JavaScript numbers, both integers and decimals/floats.

  4. Date and time: Custom date and time fields accept strings that represent a timestamp in any of these formats:
    YYYY-MM-DD HH:mm:ss => 2017-04-28 20:12:55
    yyyy-mm-ddThh:mm:ssZ => 2017-04-28T20:12:55Z
    yyyy/mm/ddThh:mm:ssZ => 2017/04/28T20:12:55Z
    yyyy-mm-dd => 2020-02-20
    yyyy-mm-dd hh:mm:ss => 20-02-20 23:42
    yyyy/mm/dd hh:mm:ss => 2020/02/20 23:42:51
    yyyy/mm/dd => 2020/02/20

  5. List: Custom list fields accept JavaScript arrays. We only accept string and integer elements in the array. The order of the elements in the array is not considered. When a new array is provided, we’ll override the previous array entirely. 

Do you need more information?

Contact us via our contact form.

Did this answer your question?