Skip to content

Application generator

ViewController

In order for a generator form to work, you need to register a ViewController with the name offline_message_generator.

CreateWidget

To create an application generator widget, use the method CallGear.UI.createWidget() with the following parameters:

  • widgetName = 'offline_message_generator'
  • the config object must contain the field id

Example:

CallGear.UI.registerViewController('offline_message_generator', function (settings, tpls) {
    var offlineMessageGenerator = CallGear.UI.createWidget('offline_message_generator', {
        settings: settings,
        template: tpls['offline_message_generator'],
        id: settings['id']
    });
    offlineMessageGenerator.render();
});

Methods

submit(data)

The method captures a successful display of a form and saves the data received from the application. In the lead generation report, such an impression will be considered a lead.

The data object should contain the following fields:

  • name - visitor name.
  • email - visitor e-mail.
  • phone - visitor phone number.
  • message - application text.
  • group_id - ID of an employee group to which this application should be distributed. The field must be filled in if the application generator is configured to distribute applications by employee groups.

cancel()

The method captures an unsuccessful display of a form. In the lead generation report, such an impression will be considered a failure.

Events

leadhide

The event occurs when you need to hide a previously shown form. This is necessary if a visitor interacts with several pages of the website at once.

leadsubmit

The event occurs in response to a call to the submit() method and confirms that the lead has been processed.

leadcancel

The event occurs in response to a call to the cancel() method and confirms that a rejection by a visitor has been captured.

Sandbox

Desktop, tablet:

Mobile: