Events From Widgets
  • 1 Minute to read
  • Dark
    Light

Events From Widgets

  • Dark
    Light

Article Summary

UCL widgets give you capability to listen for the events and perform any other actions you want to do on the occurrence of the event.

UCL widgets has following events available:

  1. widget_loaded
  2. question_loaded
  3. college_loaded
  4. thank_loaded
  5. option_clicked
  6. lead_submitted
  7. form_opened
  8. form_closed

Example of using a UCL Widget Event:

(function() {
    ucl_widget.on('widget_loaded', event => {
        // do anything when widget is loaded
        // fires everytime when a widget screen/location is changed
        // fires everytime when a question/college/thank you is loaded
        // event contains more details about the widget
        // console.log(event);
    });
    ucl_widget.on('question_loaded', event => {
        // do anything when question is loaded
        // event contains more details about the question
        // console.log(event);
    });
    ucl_widget.on('college_loaded', event => {
        // do anything when college is loaded
        // event contains more details about the colleges loaded
        // console.log(event);
    });
    ucl_widget.on('thank_loaded', event => {
        // do anything when thank you is loaded
        // event contains more details about the thank you page
        // console.log(event);
    });
    ucl_widget.on('option_clicked', event => {
        // do anything when option is clicked
        // event contains more details about the option clicked
        // console.log(event);
    });
    ucl_widget.on('lead_submitted', event => {
        // do anything when lead is submitted
        // event contains more details about the lead
        // you can fire your conversion events here (Eg: GA, Fb Pixel etc.)
        // console.log(event);
    });
    ucl_widget.on('form_opened', event => {
        // do anything when leadform is opened
        // event contains more details about the leadform
        //console.log(event);
    });
    ucl_widget.on('form_closed', event => {
        // do anything when leadform is closed
        // event contains more details about the leadform
        // console.log(event);
    });
});

We encourage you to bind your events near the body end tag or when the document is ready to make sure ucl_widget object is available at that point.

To see information about data included in the events, please visit data sent with events.


Was this article helpful?