Commit 9b2b0bc1 authored by Naveen Valecha's avatar Naveen Valecha Committed by Naveen Valecha
Browse files

Issue #3276200 by naveenvalecha: Add formtracker destination plugin.

parent 6a0320bb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -138,6 +138,12 @@ convivial_profiler.settings:
                  type: string
                form_selector:
                  type: string
                field_name:
                  type: string
                event_action:
                  type: string
                event_category:
                  type: string
                fields_selector:
                  type: sequence
                  label: 'Fields Selector'
+1 −1
Original line number Diff line number Diff line
library:
  js:
    //cdn.jsdelivr.net/gh/morpht/convivial-profiler@v0.1.26/dist/bundle.js: { type: external, minified: true }
    //cdn.jsdelivr.net/gh/morpht/convivial-profiler@v0.1.27/dist/bundle.js: { type: external, minified: true }

init:
  js:
+26 −0
Original line number Diff line number Diff line
@@ -93,6 +93,32 @@ formfiller:
        cookie: Cookie
        localstorage: Local Storage

formtracker:
  label: Form tracker
  description: Track the responses via dataLayer on submitting the form to have time series analysis of things such as sentiment.
  form:
    form_selector:
      '#type': textfield
      '#title': Form Selector
      '#description': The form selector for the form tracker e.g. form class - <code>.newsletter-signup-form</code>
      '#required': true
    field_name:
      '#type': textfield
      '#title': Form field name
      '#description': Specify the form field name to capture the value e.g. - <code>email</code>
      '#required': true
    event_action:
      '#type': textfield
      '#title': Datalayer event action
      '#required': true
      '#value': 'formsubmit'
      '#attributes':
        disabled: disabled
    event_category:
      '#type': textfield
      '#title': Datalayer event category
      '#required': true

officehours:
  label: Office hours
  description: Calculates whether the office is open based on the time of day and the timezone of the office.
+4 −2
Original line number Diff line number Diff line
@@ -11,7 +11,9 @@
  'use strict';
  Drupal.behaviors.convivialProfiler = {
    attach: function (context, settings) {
      once('convivialProfiler', 'html', context).forEach( function (element) {
       // @Todo Due of conflict in tracking of smart_content ajax blocks.
      // See the formfiller and formtracker destination plugins.
      // once('convivialProfiler', 'html', context).forEach( function (element) {
        window.convivialProfiler = new ConvivialProfiler(config.config, config.site, config.license_key);
        window.convivialProfiler.collect();
        $(document).once('cp_trackable').on('click', '.cp_trackable a.btn', function (event) {
@@ -29,7 +31,7 @@
            });
          }
        });
      });
      // });
    }
  };
})(jQuery, window, once, Drupal, drupalSettings.convivialProfiler, window.ConvivialProfiler.default);