diff --git a/app/assets/javascripts/admin/analytics-modules/ga4-button-setup.js b/app/assets/javascripts/admin/analytics-modules/ga4-button-setup.js index 6e33a2baefc..50e38fe2cdc 100644 --- a/app/assets/javascripts/admin/analytics-modules/ga4-button-setup.js +++ b/app/assets/javascripts/admin/analytics-modules/ga4-button-setup.js @@ -13,7 +13,8 @@ window.GOVUK.analyticsGa4.analyticsModules = const buttons = moduleElement.querySelectorAll('button') buttons.forEach((button) => { const event = { - event_name: 'navigation', + event_name: + button.type === 'submit' ? 'navigation' : 'select_content', type: 'button', text: button.textContent } diff --git a/spec/javascripts/admin/analytics-modules/ga4-button-setup.spec.js b/spec/javascripts/admin/analytics-modules/ga4-button-setup.spec.js index 4fa0cac69ae..69ba26e4eb3 100644 --- a/spec/javascripts/admin/analytics-modules/ga4-button-setup.spec.js +++ b/spec/javascripts/admin/analytics-modules/ga4-button-setup.spec.js @@ -18,7 +18,7 @@ describe('GOVUK.analyticsGa4.analyticsModules', function () { ga4ButtonSetup.init() expect(button.dataset.ga4Event).toEqual( - '{"event_name":"navigation","type":"button","text":"Button"}' + '{"event_name":"select_content","type":"button","text":"Button"}' ) })