Sending visitor variables to giosg

You can attach extra information about the visitor data by setting visitor variables. Typically this is information such as customer number, customer name or email.

You can find more information on the Visitor variable API from our developer documentation.

You can add customised information about the visitor to the chat via our Visitor variable API. When sending custom data about the visitor through the Visitor variable API, the data will be shown in the left side of the chat window in the giosg console. For example here the property "username" with the value of "John Doe" has been submitted via the API to be shown in the chat window:

The "username" property is also special in the giosg system, as the value of the "username" property will replace the default name of the visitor. In the example above, before submitting the username the visitor was only named "Visitor" in the giosg system. After submitting the "username" property with the value of "John Doe", the visitor's name becomes "John Doe". This way you can for example send the username property when the visitor logs in to your own system, so you will see their actual name on the chat window instead of the generic "Visitor" name.

The open lock symbol beside the "username" property on the left side means that the data was submitted without any signing algorithm. By default the data is sent as plain text. If you need to ensure that the visitor can't modify the data sent through the API, you will have to sign the sent data. You can sign the data with JWT, for example. You will need an API signing key from the giosg system to succesfully sign the data.

The general Visitor variable API call looks like this:

_giosg('visitor', 'submit', { <property_key>: <property_value> }, <signing_algorithm>, <replace_existing>, <room_information>);

If you want to send the data as plain text without any signing algorithm, you can add 'plain' as the signing algorithm. The <replace_existing> argument accepts a boolean value. If set to true, all future calls will replace all the previous data sent. If set to false, future calls will not replace the existing data, unless the data is sent with the same property key as previously.

The room information argument accepts an array of room objects, with rooms having either the id or the name specified. The id must be in the legacy room id for the room, found in the giosg console's Room settings. Either one of the properties will suffice, you don't have to specify both for the data to be submitted. 

Here's an example of the full API call that was used in the screenshot above to send the username data:

_giosg('visitor', 'submit', {username: 'John Doe'}, 'plain', false, [{id: 'spgxcgwpj3qkmfvrxqaafh5wd63js3ir5g3omascvqiqacqm'}])