2019-12-13 22:07:43 +00:00
|
|
|
(function (window) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
window.GOVUK = window.GOVUK || {};
|
|
|
|
|
|
2020-01-15 11:56:38 +00:00
|
|
|
const trackingId = 'UA-75215134-1';
|
2019-12-13 22:07:43 +00:00
|
|
|
|
|
|
|
|
// Disable analytics by default
|
|
|
|
|
window[`ga-disable-${trackingId}`] = true;
|
|
|
|
|
|
|
|
|
|
const initAnalytics = function () {
|
|
|
|
|
|
|
|
|
|
// guard against being called more than once
|
|
|
|
|
if (!('analytics' in window.GOVUK)) {
|
|
|
|
|
|
|
|
|
|
window[`ga-disable-${trackingId}`] = false;
|
|
|
|
|
|
|
|
|
|
// Load Google Analytics libraries
|
|
|
|
|
window.GOVUK.Analytics.load();
|
|
|
|
|
|
|
|
|
|
// Configure profiles and make interface public
|
|
|
|
|
// for custom dimensions, virtual pageviews and events
|
|
|
|
|
window.GOVUK.analytics = new GOVUK.Analytics({
|
|
|
|
|
trackingId: trackingId,
|
|
|
|
|
cookieDomain: 'auto',
|
|
|
|
|
anonymizeIp: true,
|
2020-01-22 11:45:10 +00:00
|
|
|
allowAdFeatures: false,
|
2020-01-14 14:14:53 +00:00
|
|
|
transport: 'beacon',
|
|
|
|
|
expires: 365
|
2019-12-13 22:07:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Track initial pageview
|
|
|
|
|
window.GOVUK.analytics.trackPageview();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.GOVUK.initAnalytics = initAnalytics;
|
|
|
|
|
})(window);
|