diff --git a/app/assets/javascripts/analytics.js b/app/assets/javascripts/analytics.js deleted file mode 100644 index e1b871cf8..000000000 --- a/app/assets/javascripts/analytics.js +++ /dev/null @@ -1,56 +0,0 @@ -let stripUUIDs = string => string.replace( - /[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}/g, '…' -); - -(function(Modules) { - "use strict"; - - function sendEvent(category, action, label) { - - if (!ga) return; - ga('send', 'event', category, action, label); - - } - - function sendVirtualPageView(path) { - - if (!ga) return; - ga('send', 'pageview', stripUUIDs('/virtual' + path)); - - } - - Modules.TrackError = function() { - - this.start = component => sendEvent( - 'Error', - $(component).data('error-type'), - $(component).data('error-label') - ); - - }; - - Modules.TrackEvent = function() { - - this.start = component => sendEvent( - $(component).data('event-category'), - $(component).data('event-action'), - $(component).data('event-label') - ); - - }; - - Modules.TrackFormSubmission = function() { - - this.start = component => { - - $(component).on('submit', function() { - - let formData = $('input[name!=csrf_token]', this).serialize(); - sendVirtualPageView(window.location.pathname + '?' + formData); - - }); - }; - - }; - -})(window.GOVUK.Modules); diff --git a/app/assets/javascripts/errorTracking.js b/app/assets/javascripts/errorTracking.js new file mode 100644 index 000000000..3b7053841 --- /dev/null +++ b/app/assets/javascripts/errorTracking.js @@ -0,0 +1,22 @@ +(function(Modules) { + "use strict"; + + Modules.TrackError = function() { + + this.start = function(component) { + + if (!ga) return; + + ga( + 'send', + 'event', + 'Error', + $(component).data('error-type'), + $(component).data('error-label') + ); + + }; + + }; + +})(window.GOVUK.Modules); diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index d1d51df89..a78581cfd 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -128,7 +128,10 @@ ga('set', 'anonymizeIp', true); ga('set', 'displayFeaturesTask', null); ga('set', 'transport', 'beacon'); - page = window.location.pathname + window.location.search; - ga('send', 'pageview', stripUUIDs(page)); + // strip UUIDs + page = (window.location.pathname + window.location.search).replace( + /[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}/g, '…' + ) + ga('send', 'pageview', page); {% endblock %} diff --git a/app/templates/views/service-settings/set-basic-view.html b/app/templates/views/service-settings/set-basic-view.html index 8d9e05823..21c0aed1f 100644 --- a/app/templates/views/service-settings/set-basic-view.html +++ b/app/templates/views/service-settings/set-basic-view.html @@ -9,11 +9,7 @@ {% block maincolumn_content %}
-
+

Basic view

Hide the dashboard and other options from team members who only need to send messages. diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html index 018c08005..c03b77803 100644 --- a/app/templates/withnav_template.html +++ b/app/templates/withnav_template.html @@ -10,13 +10,7 @@

diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 60b66f28a..b1a6ab92e 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -70,7 +70,7 @@ gulp.task('javascripts', () => gulp paths.src + 'javascripts/updateContent.js', paths.src + 'javascripts/listEntry.js', paths.src + 'javascripts/liveSearch.js', - paths.src + 'javascripts/analytics.js', + paths.src + 'javascripts/errorTracking.js', paths.src + 'javascripts/preventDuplicateFormSubmissions.js', paths.src + 'javascripts/fullscreenTable.js', paths.src + 'javascripts/conditionalRadios.js',