Sometimes you need to change the display of the widget depending on the page the user is on. For example, hide the widget with messengers and social networks on the technical support page or, on the contrary, reveal the widget on the page with payment to show the user that they can easily ask for help through a convenient communication channel.
To control the widget on the page, use the OmniWidgetApi.call('[parameter]') method, which has the following parameters:
hide_btn — hide the widget button;
show_btn — show widget button;
open — open widget;
close — minimize widget;
open_widget — open email-based case form;
close_widget — close the form for email-based case;
identify — fill in the fields of the feedback form by email;
reset — clear the fields of the feedback form by mail.
If you have multiple widgets on a page, you can control each of them individually by specifying the widget id after the parameter with a dot. For example:
OmniWidgetApi.call('hide_btn.3225')
To get a list of widget ids that are on the page, use the method:
OmniWidgetApi.call('get_list')
To see how different parameters of the method work, check out these examples: