Sending user-data from website to widget

Overview: 

You’re installing Consolto on your platform. Your users login and you would like to pass their information directly to the Consolto widget.

Guess what? We have a solution for you!

The Consolto widget can receive the users info directly from your code including: 

  • First name (required)
  • Last name
  • Email (required)
  • Phone number
  • In a multi-agent scenario, you'd need to specify the agentId provided in the team-center on every agent's card.

The way to get this done is by adding a javascript code that waits until Consolto is ready and then send the info to the widget.

Add the following code to BEFORE where you’ve integrated Consolto’s script: . 


window.addEventListener('consoltoEvent', (e) => {

     if (e.detail.consoltoReady) { //waiting until consolto widget is ready

      // Send client info

       var userDataEvent = new CustomEvent('consolto_h2w', {

       detail: {

            'et-client-info': true,

            'et-phone': '783240477851', // modify the phone number to the number that your platform captured.

            'et-first-name': 'John', // modify the first name to the name that your platform captured.

            'et-last-name': 'Dow', // modify the last name to the name that your platform captured.

            'et-email': 'johndow@gmail.com', // modify the email to the email that your platform captured.

            'et-agent-id': '<YOUR AGENT ID HERE>' // necessary only in the team-widget. In the single widget this line can be removed.

             },

         });

        window.dispatchEvent(userDataEvent);

     }

});