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 either 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. It's not recommended to use the full name of the user (first name + last name) as the username, as any users with the same full name will be seen as the same person. 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 identity verification

This feature ensures that Product Fruits can't be initialized by a user who isn't logged into your application. It can also be used to control access to your Product Fruits knowledge base. It requires additional backend work on your side. You can read more here.

User information object example

const userInfo = { username: '', // REQUIRED, must be unique 
                   email: '',
                   firstname: 'John',
                   lastname: 'Smith',
                   signUpAt: '2021-12-30T23:50:55', // Sign up date (yyyy-mm-ddThh:mm:ss) 
                   role: 'admin',
                   hmac: { // optional, required when using User identity verification
                   props: { 
                              myCustomProp1: 'my custom value', 
                              myCustomProp2: 21447,
                              myCustomProp3: ['first', 'second'],

Updating user information

If needed, this user information can be updated after initialization by using the following api call: window.productFruits.identifyUser