How to Pass Additional Variables from Your Website to Identify Visitors

You can gather and pass additional variables from your website to help you identify visitors and create a more personal communication approach. Use the data you gather to better know your customers, use filters, and segment your audience to send more targeted messages.

For example, if a user has an account in your system and you have data about this user — demographic information, site behavior, recent purchases, contact information and so on — you can send it from your backend to display it in your contact’s 13chats profile.

The data will only be recorded after your function is called, generally when the webpage is loaded or a form is submitted, that confirms the sending of the data.

What Data Can I Send?

To submit and pass additional variables you can use the chats13.identify() javascript method.

Use the create function to create new variables. If you pass any of the following variables: email, name, nickname or id, the visitor will be saved to the subscribers list*.

Use the update function to update and rewrite a subscriber’s existing data. If a visitor has not yet subscribed, data will not be saved.

Please note: to save data about your site visitors to 13chats, your visitor needs to be your subscriber — i.e. they need to send a message to your live chat and start a conversation or subscribe to your Facebook chatbot. Data from a session will only be erased after a user clears their browser cache and cookies.

Ensure that a method is called as soon as possible on the page (generally on the (load) function) to ensure that the site visitor is updated with the information provided when we authenticate them.

List of variables that you can transfer:

Variable nameDescription
idstring
your custom unique identifier, up to 255 characters
namestring
user’s email address, up to 255 characters
nicknamestring
user’s nickname, up to 255 characters
companystring
user’s company, up to 255 characters
locationa string array
user data about their country, city, and address
emailvalid email
currently logged in visitor’s valid email, i.e example@gmail.com
phoneNumberstring
currently logged in visitor’s phone number, up to 50 characters
userIdstring
your user’s unique identifier, up to 255 characters
avatarurl
an avatar image URL. Note: needs to be https
registrationDatevalid date as string
user’s registration date, must be in yyyy-mm-dd format
birthdayvalid date as string
user’s birthday, must be in yyyy-mm-dd format
lastOrderDatevalid date as string
date of user’s last order, must be in yyyy-mm-dd format
lastOrderNamestring
name of last user’s order, up to 255 characters
lastOrderIdstring
identifier of the last order, up to 255 characters
lastOrderSumdouble
total price of the last order, 1.000 format

Please note: Key names are case sensitive, write them exactly as they are displayed in the table. You can pass data to any variable listed in the table, but you cannot change its name or add other custom variables that are not in the above table. All variables are optional, none of them are required.

Sample code:

<script>
    window.addEventListener('load', function() {
      window.chats13.identify({
        id: '9999999',
        name: 'Alex',
        nickname: 'nickname',
        location: 'UK',
        email: 'email@test.com',
        phoneNumber: '17895421358',
        userId: '154876',
        avatar: 'https://avatars3.githubusercontent.com/u/2570527?s=60&v=4',
        registrationDate: '01.12.2020',
        birthday: '01.01.1970',
        lastOrderDate: '12.24.2020',
        lastOrderName: 'last Order Name',
        lastOrderId: '234234',
        lastOrderSum: '99'
      }, 'create');
    });
  </script>

How to Install the Code

Copy and paste the code snippet inside your webpage’selement integrating with your custom tracking script arguments.

In our samples function called on webpage loading, you can add any other custom function.

Where Can I Check the Received Data?

All of the variables for each contact is displayed in the Audience tab and the Conversations tab.

Navigate to the Conversations tab, choose a contact and check the information on the left under the user’s name or click Activity.

Updated: 28.02.2021