Sha256: a1c26bc9c1ae93e6792f47e2d8ff9a10dc97ae83d55a0fede7fc98393aa5ac28

Contents?: true

Size: 723 Bytes

Versions: 13

Compression:

Stored size: 723 Bytes

Contents

(function(Modules) {
  "use strict";

  Modules.AutoTrackEvent = function() {
    this.start = function(element) {
      var options = {nonInteraction: 1}, // automatic events shouldn't affect bounce rate
          category = element.data('track-category'),
          action = element.data('track-action'),
          label = element.data('track-label'),
          value = element.data('track-value');

      if (typeof label === "string") {
        options.label = label;
      }

      if (value || value === 0) {
        options.value = value;
      }

      if (GOVUK.analytics && GOVUK.analytics.trackEvent) {
        GOVUK.analytics.trackEvent(category, action, options);
      }
    }
  };

})(window.GOVUK.Modules);

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
govuk_frontend_toolkit-4.13.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.12.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.11.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.10.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.9.1 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.9.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.8.2 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.8.1 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.8.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.7.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.6.1 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.6.0 app/assets/javascripts/govuk/modules/auto-track-event.js
govuk_frontend_toolkit-4.5.0 app/assets/javascripts/govuk/modules/auto-track-event.js