src/tracker.js
/**
   * Tracks a single form and then resubmits it
   */
Tracks a single form and then resubmits it
Tracks a single form and then resubmits it
trackForm(eventName = 'Tracked Form', selector, options) {
    let els;
    const _options = isString(selector) ? options || {} : selector || {};
    const bindEl = (el, ev, props, opts) => {
      addEventListener(el, 'submit', (e) => {
        this.trackFormHandler(e, el, ev, _options);
      });
    };
    if (_options.elements) {
      els = _options.elements;
    } else {
      els = getElement(selector, _options);
    }
    if (els && els.length > 0) {
      for (let i in els) {
        bindEl(els[i], eventName, _options);
      }
    }
  }
trackForm ( eventName = 'Tracked Form' , selector , options ) { let els ; const _options = isString ( selector ) ? options || { } : selector || { } ; const bindEl = ( el , ev , props , opts ) => { addEventListener ( el , 'submit' , ( e ) => { this . trackFormHandler ( e , el , ev , _options ) ; } ) ; } ; if ( _options . elements ) { els = _options . elements ; } else { els = getElement ( selector , _options ) ; } if ( els && els . length > 0 ) { for ( let i in els ) { bindEl ( els [ i ] , eventName , _options ) ; } } }
Tracks a single form and then resubmits it
Tracks a single form and then resubmits it
// attach event if form was found