mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-23 08:49:46 -04:00
Add event tracking to window.GOVUK.analytics
app/assets/javascripts/errorTracking.js sent events to `window.ga`. This extends the API of `window.GOVUK.Analytics` to include support for sending events so all calls to `window.ga` can use it instead of direct access. This use of `window.ga` was missed from the initial work on `window.GOVUK.Anaytics`.
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
(function(Modules) {
|
||||
(function(window) {
|
||||
"use strict";
|
||||
|
||||
Modules.TrackError = function() {
|
||||
window.GOVUK.Modules.TrackError = function() {
|
||||
|
||||
this.start = function(component) {
|
||||
|
||||
if (!('ga' in window)) return;
|
||||
if (!('analytics' in window.GOVUK)) return;
|
||||
|
||||
ga(
|
||||
'send',
|
||||
'event',
|
||||
window.GOVUK.analytics.trackEvent(
|
||||
'Error',
|
||||
$(component).data('error-type'),
|
||||
$(component).data('error-label')
|
||||
{
|
||||
'label': $(component).data('error-label')
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})(window.GOVUK.Modules);
|
||||
})(window);
|
||||
|
||||
Reference in New Issue
Block a user