Identifying users

Product Fruits needs to identify users to work properly. For instance, we have to know which tours or announcements the particular user was interacting with. If we didn't know this, we could show Product Fruits content multiple times or never. This is usually not the expected behavior.

User information is transferred through the JavaScript installation. The only required user property is username. This must be a unique identifier of the user. It can be the username, e-mail, ID, or any unique immutable value assigned to this user. If you don't want to transfer real usernames to Product Fruits, hash them (i.e. MD5, SHA1).

If you plan to use one of our two-way sync integrations, you should send e-mails to the username field. Many two-way synchronizations need this for proper user pairing.

Built-in user properties

  • username - this is the only required field
  • firstname - accepts strings
  • lastname - accepts strings
  • signUpAt - accepts strings. The standard JSON Data format is highly recommended (yyyy-mm-ddThh:mm:ss)
  • role - accepts strings. If you need multiple roles, use a custom property

Custom properties

You can also pass custom properties to users. If you want to segment your content (display different things to different users), this is important to set up correctly.

You can pass custom user information to the props field. This object can hold any property with one of these types:

  • string
  • number
  • array of strings or numbers
  • boolean

We recommend using standard naming for these properties, try to avoid spaces and other special characters in names.

User information object example

const userInfo = { username: 'john@example.com', // REQUIRED, must be unique 
                   email: 'john@example.com',
                   firstname: 'John',
                   lastname: 'Smith',
                   signUpAt: '2021-12-30T23:50:55', // Sign up date (yyyy-mm-ddThh:mm:ss) 
                   role: 'admin',
                   props: { 
                              myCustomProp1: 'my custom value', 
                              myCustomProp2: 21447,
                              myCustomProp3: ['first', 'second'],
                          } 
                   };