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.

  • let myWidget = document.querySelector('triggerbee-widget').shadowRoot;
    • Parent object for the widget shadowroot


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


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

Examples


let myWidget = document.querySelector('triggerbee-widget').shadowRoot;
const couponCodes = myWidget.querySelector('[data-external-id="couponCodes"]');

Still need help? Contact Us Contact Us