Script Events in editor

Customize your campaign with JavaScript code that is triggered on specific events, such as when campaign is opened, when visitor submits a form.

Some things you can do


Guidelines

Use these helper variables to access helpful objects.

  • widget =
    • Parent DOM object containing the campaign widget


  • let mywidgetId = widget .getAttribute('data-id');
    • Gets the Id of the widget


  • let myWidgetInConfig = triggerbee.widgets.configurations.find(x => x.id == mywidgetId );
    • Configuration for the campaign

Examples

const couponCodes = widget.querySelector('[data-external-id="couponCodes"]');

Events listener receive event arguments in a sub object called "details", like this:

Still need help? Contact Us Contact Us