Sha256: 244939698a65b49cfd6bb409b574ab0ab42c40edfd25aeefad1a3243c87067ab
Contents?: true
Size: 1.54 KB
Versions: 9
Compression:
Stored size: 1.54 KB
Contents
window.GOVUK = window.GOVUK || {} window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {} var initFunction = function () { var consentCookie = window.GOVUK.getConsentCookie() if (consentCookie && consentCookie.usage) { window.GOVUK.analyticsGa4.vars.internalDomains = [] window.GOVUK.analyticsGa4.vars.internalDomains.push(window.GOVUK.analyticsGa4.core.trackFunctions.getHostname()) window.GOVUK.analyticsGa4.core.trackFunctions.appendDomainsWithoutWWW(window.GOVUK.analyticsGa4.vars.internalDomains) var attachmentLinkData = [ { key: 'data-module', value: 'ga4-link-tracker' }, { key: 'data-ga4-track-links-only', value: '' }, { key: 'data-ga4-link', value: JSON.stringify({ event_name: 'navigation', type: 'attachment' }) }] window.GOVUK.analyticsGa4.core.trackFunctions.addAttributesToElements('[data-ga4-attachment-link]', attachmentLinkData) window.GOVUK.analyticsGa4.core.load() var analyticsModules = window.GOVUK.analyticsGa4.analyticsModules for (var property in analyticsModules) { var module = analyticsModules[property] if (typeof module.init === 'function') { try { module.init() } catch (e) { // if there's a problem with the module, catch the error to allow other modules to start console.warn('Error starting analytics module ' + property + ': ' + e.message, window.location) } } } } else { window.addEventListener('cookie-consent', window.GOVUK.analyticsGa4.init) } } window.GOVUK.analyticsGa4.init = initFunction
Version data entries
9 entries across 9 versions & 1 rubygems