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 name | Description |
id | string your custom unique identifier, up to 255 characters |
name | string user’s email address, up to 255 characters |
nickname | string user’s nickname, up to 255 characters |
company | string user’s company, up to 255 characters |
location | a string array user data about their country, city, and address |
valid email currently logged in visitor’s valid email, i.e example@gmail.com | |
phoneNumber | string currently logged in visitor’s phone number, up to 50 characters |
userId | string your user’s unique identifier, up to 255 characters |
avatar | url an avatar image URL. Note: needs to be https |
registrationDate | valid date as string user’s registration date, must be in yyyy-mm-dd format |
birthday | valid date as string user’s birthday, must be in yyyy-mm-dd format |
lastOrderDate | valid date as string date of user’s last order, must be in yyyy-mm-dd format |
lastOrderName | string name of last user’s order, up to 255 characters |
lastOrderId | string identifier of the last order, up to 255 characters |
lastOrderSum | double 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: '2020-12-01',
birthday: '1970-01-01',
lastOrderDate: '2020-12-24',
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: 02.02.2022