From cd8f690160d352c7bf66da6e07e7a6cb51f4bf19 Mon Sep 17 00:00:00 2001 From: James Chan Date: Mon, 26 Sep 2022 12:46:09 +0100 Subject: [PATCH] Update analyticsGA4 naming convention Update to analyticsGa4 --- app/assets/javascripts/analytics.js.erb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/analytics.js.erb b/app/assets/javascripts/analytics.js.erb index 3cfc2a26d..b3e6c9e0b 100644 --- a/app/assets/javascripts/analytics.js.erb +++ b/app/assets/javascripts/analytics.js.erb @@ -149,19 +149,19 @@ var gtm_id = '<%= ENV["GOOGLE_TAG_MANAGER_ID"] %>' || null var gtag_id = '<%= ENV["GTAG_ID"] %>' || null if (gtm_id || gtag_id) { - if (typeof window.GOVUK.analyticsGA4.init !== 'undefined') { - window.GOVUK.analyticsGA4 = window.GOVUK.analyticsGA4 || {} - window.GOVUK.analyticsGA4.vars = window.GOVUK.analyticsGA4.vars || {} - window.GOVUK.analyticsGA4.vars.gem_version = '<%= GovukPublishingComponents::VERSION %>' + if (typeof window.GOVUK.analyticsGa4.init !== 'undefined') { + window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {} + window.GOVUK.analyticsGa4.vars = window.GOVUK.analyticsGa4.vars || {} + window.GOVUK.analyticsGa4.vars.gem_version = '<%= GovukPublishingComponents::VERSION %>' if (gtag_id) { - window.GOVUK.analyticsGA4.vars.gtag_id = gtag_id + window.GOVUK.analyticsGa4.vars.gtag_id = gtag_id } else { - window.GOVUK.analyticsGA4.vars.id = gtm_id - window.GOVUK.analyticsGA4.vars.auth = '<%= ENV["GOOGLE_TAG_MANAGER_AUTH"] %>' - window.GOVUK.analyticsGA4.vars.preview = '<%= ENV["GOOGLE_TAG_MANAGER_PREVIEW"] %>' + window.GOVUK.analyticsGa4.vars.id = gtm_id + window.GOVUK.analyticsGa4.vars.auth = '<%= ENV["GOOGLE_TAG_MANAGER_AUTH"] %>' + window.GOVUK.analyticsGa4.vars.preview = '<%= ENV["GOOGLE_TAG_MANAGER_PREVIEW"] %>' } - window.GOVUK.analyticsGA4.init() + window.GOVUK.analyticsGa4.init() } }