Skip to content

Commit

Permalink
Add section value to link tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Sep 27, 2023
1 parent b1dfd75 commit fe4c129
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/surveys.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'\'>Close</a>' +
' <h2 class="survey-title" id="survey-title">{{title}}</h2>' +
'<div data-module="ga4-link-tracker" data-ga4-track-links-only ' +
'data-ga4-link=\'' + JSON.stringify({ event_name: 'navigation', type: 'survey banner', index: 1, index_total: 1 }) + '\'>' +
'data-ga4-link=\'' + JSON.stringify({ event_name: 'navigation', type: 'survey banner', index: 1, index_total: 1, section: '{{title}}' }) + '\'>' +
children +
'</div>' +
' </div>' +
Expand Down
2 changes: 1 addition & 1 deletion spec/javascripts/surveys.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit fe4c129

Please sign in to comment.