mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-30 22:21:16 -04:00
Track event when someone previews basic view
We’re interested to know which services are looking at the basic view preview (even if they’re not turning it on). This commit logs their service IDs as events into Google Analytics.
This commit is contained in:
32
app/assets/javascripts/analytics.js
Normal file
32
app/assets/javascripts/analytics.js
Normal file
@@ -0,0 +1,32 @@
|
||||
(function(Modules) {
|
||||
"use strict";
|
||||
|
||||
if (!ga) return;
|
||||
|
||||
function sendEvent(category, action, label) {
|
||||
|
||||
ga('send', 'event', category, action, label);
|
||||
|
||||
}
|
||||
|
||||
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')
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
})(window.GOVUK.Modules);
|
||||
@@ -1,22 +0,0 @@
|
||||
(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);
|
||||
Reference in New Issue
Block a user