From fe4c129abbeeef878853794094abf68d71d882a4 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:09:22 +0100 Subject: [PATCH] Add section value to link tracker --- app/assets/javascripts/surveys.js | 2 +- spec/javascripts/surveys.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/surveys.js b/app/assets/javascripts/surveys.js index f0a5855c3..cfd79af09 100644 --- a/app/assets/javascripts/surveys.js +++ b/app/assets/javascripts/surveys.js @@ -28,7 +28,7 @@ '\'>Close' + '

{{title}}

' + '
' + + 'data-ga4-link=\'' + JSON.stringify({ event_name: 'navigation', type: 'survey banner', index: 1, index_total: 1, section: '{{title}}' }) + '\'>' + children + '
' + ' ' + diff --git a/spec/javascripts/surveys.spec.js b/spec/javascripts/surveys.spec.js index 4a24175e8..1491799ae 100644 --- a/spec/javascripts/surveys.spec.js +++ b/spec/javascripts/surveys.spec.js @@ -104,7 +104,7 @@ describe('Surveys', function () { var expectedGa4Auto = { event_data: { event_name: 'element_visible', type: 'survey banner' } } var expectedGa4Event = { event_name: 'select_content', type: 'survey banner', action: 'closed', section: 'Tell us what you think of GOV.UK' } - var expectedGa4Link = { event_name: 'navigation', type: 'survey banner', index: 1, index_total: 1 } + var expectedGa4Link = { event_name: 'navigation', type: 'survey banner', index: 1, index_total: 1, section: 'Tell us what you think of GOV.UK' } var expectedGa4Form = { event_name: 'form_submit', type: 'survey banner',