mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
Update Google Analytics tracker config
Removes the following fields from the tracker config: - `name`, which was erroring due to it including a `.` - `displayFeaturesTask` which seems to be deprecated Also refactors the `create` command to put all fields into the options parameter, as shown in the developer docs: https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers
This commit is contained in:
@@ -6,10 +6,14 @@
|
||||
// Stripped-down wrapper for Google Analytics, based on:
|
||||
// https://github.com/alphagov/static/blob/master/doc/analytics.md
|
||||
const Analytics = function (config) {
|
||||
window.ga('create', config.trackingId, config.cookieDomain, config.name, { 'cookieExpires': config.expires * 24 * 60 * 60 });
|
||||
window.ga('create', {
|
||||
'trackingId': config.trackingId,
|
||||
'cookieDomain': config.cookieDomain,
|
||||
'cookieExpires': config.expires * 24 * 60 * 60
|
||||
});
|
||||
|
||||
window.ga('set', 'anonymizeIp', config.anonymizeIp);
|
||||
window.ga('set', 'displayFeaturesTask', config.displayFeaturesTask);
|
||||
window.ga('set', 'allowAdFeatures', config.allowAdFeatures);
|
||||
window.ga('set', 'transport', config.transport);
|
||||
|
||||
};
|
||||
|
||||
@@ -24,9 +24,8 @@
|
||||
trackingId: trackingId,
|
||||
cookieDomain: 'auto',
|
||||
anonymizeIp: true,
|
||||
displayFeaturesTask: null,
|
||||
allowAdFeatures: false,
|
||||
transport: 'beacon',
|
||||
name: 'GOVUK.analytics',
|
||||
expires: 365
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user