govuk_publishing_components 35.19.0 → 35.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/icon-close.svg +1 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +2 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +8 -2
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js +24 -0
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js +4 -5
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
  8. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +3 -5
  10. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +21 -31
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +31 -8
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +13 -0
  13. data/app/views/govuk_publishing_components/components/_accordion.html.erb +9 -13
  14. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -6
  15. data/app/views/govuk_publishing_components/components/_intervention.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +6 -10
  17. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +14 -24
  18. data/app/views/govuk_publishing_components/components/_share_links.html.erb +2 -6
  19. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -4
  20. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +10 -1
  21. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +4 -8
  22. data/app/views/govuk_publishing_components/components/_tabs.html.erb +2 -4
  23. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +4 -6
  24. data/app/views/govuk_publishing_components/components/docs/image_card.yml +2 -2
  25. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +6 -8
  26. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -3
  27. data/lib/govuk_publishing_components/presenters/layout_footer_helper.rb +3 -5
  28. data/lib/govuk_publishing_components/version.rb +1 -1
  29. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6d8b36d61c9301cb5d969679a14c93b6b43914a3a734d05e4ae5702b0fb0f79
4
- data.tar.gz: 49e458e28c81c1368445b4e9948aa31614ec2a506f9f989083780a0ce6de885d
3
+ metadata.gz: d1878b4cfefb05ba090334ac9990ead5cd73b519b0dd5086fa15d48715f7fc13
4
+ data.tar.gz: 3916e46d02628289d1667218a570c67b7b809c584da24064412cc948be37fd23
5
5
  SHA512:
6
- metadata.gz: 107aa5aee8b2c2c8268342683df0405cc071ada39032d723fd21299a0af1abc6bec4bb5fb7d89879775780bccc32d27b1ac9eb375e28cda218d0016b8cb843d1
7
- data.tar.gz: 994233cc78dcaa2ce4a604f3cb2d3be54582bfcfa40b6df323929a808d8d7d56e30e6c1403422a71968d399e27dc6141534f49af06f5713198db721b91d461a1
6
+ metadata.gz: 764549f50e7ea206131c5cbbbe6ac12e693ed6a8e08c4e27ab2575eac6adf0788a725cda4790b388d58bb3f81884f98e6ff7902b57b906730db6b550cd60acee
7
+ data.tar.gz: 1d3a83a6d8fb0e602e5b3fdcb54713f79d83e7266b4aa1fe873c41f941489fcac11edac78e03d7ebf655d35aee37c5c4a7cd0c9fe690ec0305b5f4a68567138b
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"><path fill="#0B0C0C" d="M2 15.435 15.435 2l2.121 2.121L4.121 17.556z"/><path fill="#0B0C0C" d="M15.436 17.557 2 4.122l2.12-2.121 13.436 13.435z"/></svg>
@@ -325,6 +325,7 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
325
325
  var target = data.event.target
326
326
  ecommerceSchema.search_results.ecommerce.items.push({
327
327
  item_id: target.getAttribute('data-ga4-ecommerce-path'),
328
+ item_content_id: target.getAttribute('data-ga4-ecommerce-content-id') || undefined,
328
329
  item_name: target.textContent,
329
330
  item_list_name: listTitle,
330
331
  index: window.GOVUK.analyticsGa4.core.ecommerceHelperFunctions.getIndex(target, startPosition)
@@ -351,6 +352,7 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
351
352
 
352
353
  ecommerceSchema.search_results.ecommerce.items.push({
353
354
  item_id: path,
355
+ item_content_id: item.getAttribute('data-ga4-ecommerce-content-id') || undefined,
354
356
  item_list_name: listTitle,
355
357
  index: window.GOVUK.analyticsGa4.core.ecommerceHelperFunctions.getIndex(item, startPosition)
356
358
  })
@@ -95,6 +95,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
95
95
  data.external = trackFunctions.isExternalLink(data.url) ? 'true' : 'false'
96
96
  data.index = this.setIndex(data.index, event.target)
97
97
 
98
+ // flatten the attributes in index into the main data
99
+ if (data.index) {
100
+ for (var prop in data.index) {
101
+ data[prop] = data.index[prop]
102
+ }
103
+ delete data.index
104
+ }
105
+
98
106
  if (data.type === 'smart answer' && data.action === 'change response') {
99
107
  data.section = this.PIIRemover.stripPIIWithOverride(data.section, true, true)
100
108
  }
@@ -117,7 +125,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
117
125
  if (target.getAttribute('data-ga4-index')) {
118
126
  try {
119
127
  var indexLink = JSON.parse(target.getAttribute('data-ga4-index'))
120
-
121
128
  // Check whether the index object already exists on a parent element, as is the case with tracking accordion links.
122
129
  // If true, combine data-ga4-index with the index object. Otherwise, just return indexLink
123
130
  index = index ? window.GOVUK.extendObject(index, indexLink) : indexLink
@@ -126,7 +133,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
126
133
  return
127
134
  }
128
135
  }
129
-
130
136
  return index
131
137
  }
132
138
 
@@ -0,0 +1,24 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
3
+ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analyticsModules || {};
4
+
5
+ (function (analyticsModules) {
6
+ 'use strict'
7
+
8
+ var Ga4PrintIntentTracker = {
9
+ init: function () {
10
+ window.addEventListener('beforeprint', function () {
11
+ var data = {
12
+ event_name: 'print_page',
13
+ type: 'print page',
14
+ method: 'browser print'
15
+ }
16
+ var schema = new window.GOVUK.analyticsGa4.Schemas()
17
+ schema = schema.mergeProperties(data, 'event_data')
18
+ window.GOVUK.analyticsGa4.core.sendData(schema)
19
+ })
20
+ }
21
+ }
22
+
23
+ analyticsModules.Ga4PrintIntentTracker = Ga4PrintIntentTracker
24
+ })(window.GOVUK.analyticsGa4.analyticsModules)
@@ -118,7 +118,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
118
118
  // following will be undefined if tracking percentages
119
119
  data.text = node.eventData.text
120
120
  data.section = node.eventData.text
121
- data.index = node.eventData.index
121
+ data.index_section = node.eventData.index_section
122
+ data.index_section_count = node.eventData.index_section_count
122
123
  // following will be undefined if tracking headings
123
124
  data.percent_scrolled = node.eventData.percent_scrolled
124
125
 
@@ -165,10 +166,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
165
166
  eventData: {
166
167
  type: type,
167
168
  text: heading.textContent.replace(/\s+/g, ' ').trim(),
168
- index: {
169
- index_section: i + 1,
170
- index_section_count: totalHeadings
171
- }
169
+ index_section: i + 1,
170
+ index_section_count: totalHeadings
172
171
  }
173
172
  })
174
173
  }
@@ -3,6 +3,7 @@
3
3
  //= require ./analytics-ga4/ga4-schemas
4
4
  //= require ./analytics-ga4/pii-remover
5
5
  //= require ./analytics-ga4/ga4-page-views
6
+ //= require ./analytics-ga4/ga4-print-intent-tracker
6
7
  //= require ./analytics-ga4/ga4-specialist-link-tracker
7
8
  //= require ./analytics-ga4/ga4-link-tracker
8
9
  //= require ./analytics-ga4/ga4-event-tracker
@@ -62,7 +62,7 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
62
62
  var isGa4Enabled = dataModule ? dataModule.indexOf('ga4-event-tracker') !== -1 : false
63
63
  if (isGa4Enabled) {
64
64
  var indexTotal = this.$module.querySelectorAll('.govuk-accordion__section').length
65
- var showAllAttributesGa4 = { event_name: 'select_content', type: 'accordion', index: { index_section: 0, index_section_count: indexTotal } }
65
+ var showAllAttributesGa4 = { event_name: 'select_content', type: 'accordion', index_section: 0, index_section_count: indexTotal }
66
66
  showAll = this.$module.querySelector(this.showAllControls)
67
67
  showAll.setAttribute('data-ga4-event', JSON.stringify(showAllAttributesGa4))
68
68
  }
@@ -84,7 +84,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
84
84
 
85
85
  // if GA4 is enabled, set attributes on 'show all sections' for tracking using ga4-event-tracker
86
86
  if (this.$module.isGa4Enabled) {
87
- var showAllAttributesGa4 = { event_name: 'select_content', type: 'step by step', index: { index_section: 0, index_section_count: this.$module.totalSteps } }
87
+ var showAllAttributesGa4 = { event_name: 'select_content', type: 'step by step', index_section: 0, index_section_count: this.$module.totalSteps }
88
88
  this.$module.showOrHideAllButton.setAttribute('data-ga4-event', JSON.stringify(showAllAttributesGa4))
89
89
  }
90
90
  }
@@ -196,10 +196,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
196
196
  event_name: 'select_content',
197
197
  type: 'step by step',
198
198
  text: titleText.trim(),
199
- index: {
200
- index_section: i + 1,
201
- index_section_count: this.$module.totalSteps
202
- },
199
+ index_section: i + 1,
200
+ index_section_count: this.$module.totalSteps,
203
201
  index_total: thisel.querySelectorAll('a').length
204
202
  }
205
203
 
@@ -366,11 +366,9 @@
366
366
  if (!entry.hadRecentInput) {
367
367
  var firstEntry = sessionEntries[0];
368
368
  var latestEntry = sessionEntries[sessionEntries.length - 1];
369
- if (sessionEntries.length &&
370
- (entry.startTime - latestEntry.startTime >= 1000 ||
371
- entry.startTime - firstEntry.startTime >= 5000)) {
372
- sessionValue = entry.value;
373
- sessionEntries = [entry];
369
+ if (sessionEntries.length && (entry.startTime - latestEntry.startTime >= 1000 || entry.startTime - firstEntry.startTime >= 5000)) {
370
+ sessionValue = entry.value;
371
+ sessionEntries = [entry];
374
372
  }
375
373
  else {
376
374
  sessionValue += entry.value;
@@ -445,7 +443,8 @@
445
443
 
446
444
  var ALL_ENTRIES = [];
447
445
  function observe(type, callback, options) {
448
- if (typeof PerformanceObserver === "function" && PerformanceObserver.supportedEntryTypes.includes(type)) {
446
+ if (typeof PerformanceObserver === "function" &&
447
+ PerformanceObserver.supportedEntryTypes.includes(type)) {
449
448
  var po = new PerformanceObserver(function (list) {
450
449
  list.getEntries().forEach(function (entry) { return callback(entry); });
451
450
  });
@@ -547,7 +546,7 @@
547
546
  // -------------------------------------------------------------------------
548
547
  /// End
549
548
  // -------------------------------------------------------------------------
550
- var SCRIPT_VERSION = "311";
549
+ var SCRIPT_VERSION = "312";
551
550
  var logger = new Logger();
552
551
  var globalConfig = fromObject(LUX);
553
552
  logger.logEvent(LogEvent.EvaluationStart, [SCRIPT_VERSION]);
@@ -695,7 +694,7 @@
695
694
  // Record the FIRST input delay.
696
695
  function recordDelay(delay) {
697
696
  if (!gFirstInputDelay) {
698
- gFirstInputDelay = delay;
697
+ gFirstInputDelay = floor(delay);
699
698
  // remove event listeners
700
699
  gaEventTypes.forEach(function (eventType) {
701
700
  removeEventListener(eventType, onInput, ghListenerOptions);
@@ -1265,10 +1264,7 @@
1265
1264
  var num = 0;
1266
1265
  for (var i = 0, len = aElems.length; i < len; i++) {
1267
1266
  var e = aElems[i];
1268
- if (e.src &&
1269
- !e.async &&
1270
- !e.defer &&
1271
- 0 !== (e.compareDocumentPosition(lastViewportElem) & 4)) {
1267
+ if (e.src && !e.async && !e.defer && 0 !== (e.compareDocumentPosition(lastViewportElem) & 4)) {
1272
1268
  // If the script has a SRC and async is false and it occurs BEFORE the last viewport element,
1273
1269
  // then increment the counter.
1274
1270
  num++;
@@ -1498,8 +1494,6 @@
1498
1494
  }
1499
1495
  return getHighPercentileINP();
1500
1496
  }
1501
- // function simplified for our use, original would get the customerid from the script src URL
1502
- // but we set it inside the code in this file, so this function just returns that
1503
1497
  function getCustomerId() {
1504
1498
  return LUX.customerid || "";
1505
1499
  }
@@ -1609,12 +1603,7 @@
1609
1603
  var vw = document.documentElement.clientWidth;
1610
1604
  // Return true if the top-left corner is in the viewport and it has width & height.
1611
1605
  var lt = findPos(e);
1612
- return (lt[0] >= 0 &&
1613
- lt[1] >= 0 &&
1614
- lt[0] < vw &&
1615
- lt[1] < vh &&
1616
- e.offsetWidth > 0 &&
1617
- e.offsetHeight > 0);
1606
+ return (lt[0] >= 0 && lt[1] >= 0 && lt[0] < vw && lt[1] < vh && e.offsetWidth > 0 && e.offsetHeight > 0);
1618
1607
  }
1619
1608
  // Return an array containing the top & left coordinates of the element.
1620
1609
  // from http://www.quirksmode.org/js/findpos.html
@@ -1838,7 +1827,7 @@
1838
1827
  !gSyncId ||
1839
1828
  !_sample() || // OUTSIDE the sampled range
1840
1829
  !gbLuxSent // LUX has NOT been sent yet, so wait to include it there
1841
- ) {
1830
+ ) {
1842
1831
  return;
1843
1832
  }
1844
1833
  var sCustomerData = valuesToString(getUpdatedCustomData());
@@ -2083,6 +2072,14 @@
2083
2072
  // Set "LUX.auto=false" to disable send results automatically and
2084
2073
  // instead you must call LUX.send() explicitly.
2085
2074
  if (globalConfig.auto) {
2075
+ var sendBeaconWhenVisible_1 = function () {
2076
+ if (globalConfig.trackHiddenPages) {
2077
+ _sendLux();
2078
+ }
2079
+ else {
2080
+ onVisible(_sendLux);
2081
+ }
2082
+ };
2086
2083
  var sendBeaconAfterMinimumMeasureTime_1 = function () {
2087
2084
  var elapsedTime = _now();
2088
2085
  var timeRemaining = globalConfig.minMeasureTime - elapsedTime;
@@ -2093,12 +2090,12 @@
2093
2090
  ]);
2094
2091
  if (document.readyState === "complete") {
2095
2092
  // If onload has already passed, send the beacon now.
2096
- _sendLux();
2093
+ sendBeaconWhenVisible_1();
2097
2094
  }
2098
2095
  else {
2099
2096
  // Ow, send the beacon slightly after window.onload.
2100
2097
  addListener("load", function () {
2101
- setTimeout(_sendLux, 200);
2098
+ setTimeout(sendBeaconWhenVisible_1, 200);
2102
2099
  });
2103
2100
  }
2104
2101
  }
@@ -2107,14 +2104,7 @@
2107
2104
  setTimeout(sendBeaconAfterMinimumMeasureTime_1, timeRemaining);
2108
2105
  }
2109
2106
  };
2110
- if (globalConfig.trackHiddenPages) {
2111
- // The trackHiddenPages config forces the beacon to be sent even when the page is not visible.
2112
- sendBeaconAfterMinimumMeasureTime_1();
2113
- }
2114
- else {
2115
- // Otherwise we only send the beacon when the page is visible.
2116
- onVisible(sendBeaconAfterMinimumMeasureTime_1);
2117
- }
2107
+ sendBeaconAfterMinimumMeasureTime_1();
2118
2108
  }
2119
2109
  // When newBeaconOnPageShow = true, we initiate a new page view whenever a page is restored from
2120
2110
  // bfcache. Since we have no "onload" event to hook into after a bfcache restore, we rely on the
@@ -41,13 +41,6 @@
41
41
  }
42
42
  }
43
43
 
44
- @include govuk-media-query($from: tablet) {
45
- .gem-c-image-card.gem-c-image-card--two-thirds {
46
- margin: 0 (- govuk-spacing(3)) govuk-spacing(6) (- govuk-spacing(3));
47
- display: block;
48
- }
49
- }
50
-
51
44
  @include govuk-media-query($from: mobile, $until: tablet) {
52
45
  .gem-c-image-card {
53
46
  margin: 0 (- govuk-spacing(3)) govuk-spacing(6) (- govuk-spacing(3));
@@ -77,7 +70,6 @@
77
70
 
78
71
  .gem-c-image-card__text-wrapper.gem-c-image-card__text-wrapper--two-thirds {
79
72
  @include govuk-grid-column($width: two-thirds, $float: right, $at: tablet);
80
- padding-left: 0;
81
73
  }
82
74
  }
83
75
 
@@ -91,6 +83,37 @@
91
83
  border-bottom: none;
92
84
  }
93
85
 
86
+ .gem-c-image-card.gem-c-image-card--two-thirds {
87
+ // Change default flex-direction from column-reverse
88
+ // so that the image and text appear in the same row,
89
+ // with the image to the left
90
+ flex-direction: row-reverse;
91
+ -ms-flex-direction: row-reverse;
92
+ // Wrap flex items onto a new line and ensure
93
+ // that items are aligned correctly
94
+ flex-wrap: wrap-reverse;
95
+ -ms-flex-wrap: wrap-reverse;
96
+ justify-content: flex-end;
97
+ align-items: flex-end;
98
+ }
99
+
100
+ .gem-c-image-card__image-wrapper.gem-c-image-card__image-wrapper--one-third {
101
+ // The first two values set flex-grow and flex-basis to 0
102
+ // This ensures that the flex item does not grow or shrink
103
+ // The the last value, sets flex-basis to 95px
104
+ // padding-left is set to 15px and the image used is 80px wide
105
+ flex: 0 0 95px;
106
+ padding-right: 0;
107
+ }
108
+
109
+ .gem-c-image-card__text-wrapper.gem-c-image-card__text-wrapper--two-thirds {
110
+ // The first two values set flex-grow and flex-basis to 1
111
+ // This allows the flex item contain the image card text to grow or shrink
112
+ // The last value, sets flex-basis to 70%
113
+ // If the width of the flex-item shrinks below 70%, it will wrap onto a new line
114
+ flex: 1 1 70%;
115
+ }
116
+
94
117
  .gem-c-image-card__title {
95
118
  margin: 0;
96
119
  }
@@ -91,6 +91,19 @@ $large-input-size: 50px;
91
91
  &:focus {
92
92
  @include gem-c-search-input-focus;
93
93
  }
94
+
95
+ // Note: this is a non-standard CSS feature and will not do anything in Firefox. https://bugzilla.mozilla.org/show_bug.cgi?id=1417753
96
+ &::-webkit-search-cancel-button {
97
+ -webkit-appearance: none;
98
+ background-image: image-url("govuk_publishing_components/icon-close.svg");
99
+ background-position: center;
100
+ background-repeat: no-repeat;
101
+ cursor: pointer;
102
+ height: 20px;
103
+ margin-left: 0;
104
+ margin-right: 0;
105
+ width: 20px;
106
+ }
94
107
  }
95
108
 
96
109
  @mixin icon-positioning($container-size) {
@@ -46,14 +46,12 @@
46
46
  event_name: "select_content",
47
47
  type: "accordion",
48
48
  text: heading_text,
49
- index: {
50
- index_section: index,
51
- index_section_count: items.length,
52
- },
49
+ index_section: index,
50
+ index_section_count: items.length,
53
51
  }.to_json
54
52
 
55
- # These attributes have been created separately from the item[:data_attributes]
56
- # object in order to keep them from colliding with GA4 event tracking and UA
53
+ # These attributes have been created separately from the item[:data_attributes]
54
+ # object in order to keep them from colliding with GA4 event tracking and UA
57
55
  # tracking attributes
58
56
  ga4_link_data_attributes = {}
59
57
  ga4_link_data_attributes[:module] = "ga4-link-tracker"
@@ -63,10 +61,8 @@
63
61
  event_name: "navigation",
64
62
  type: "accordion",
65
63
  section: heading_text,
66
- index: {
67
- index_section: index,
68
- index_section_count: (items.length),
69
- }
64
+ index_section: index,
65
+ index_section_count: (items.length),
70
66
  }.to_json
71
67
  end
72
68
 
@@ -94,9 +90,9 @@
94
90
  <%= tag.div(item[:summary][:text], id: "#{id}-summary-#{index}", class: summary_classes) if item[:summary].present? %>
95
91
  <% end %>
96
92
  <%= tag.div(
97
- item[:content][:html],
98
- id: "#{id}-content-#{index}",
99
- class: "govuk-accordion__section-content",
93
+ item[:content][:html],
94
+ id: "#{id}-content-#{index}",
95
+ class: "govuk-accordion__section-content",
100
96
  'aria-labelledby': "#{id}-heading-#{index}",
101
97
  data: ga4_link_data_attributes
102
98
  ) %>
@@ -44,9 +44,7 @@
44
44
  <% link_text = format_numbers ? cl_helper.wrap_numbers_with_spans(contents_item[:text]) : contents_item[:text]
45
45
  if ga4_tracking
46
46
  ga4_data[:event_name] = cl_helper.get_ga4_event_name(contents_item[:href]) if contents_item[:href]
47
- ga4_data[:index] = {
48
- "index_link": index_link,
49
- }
47
+ ga4_data[:index_link] = index_link
50
48
  end
51
49
  %>
52
50
  <%= link_to_if !contents_item[:active], link_text, contents_item[:href],
@@ -69,9 +67,7 @@
69
67
  <%
70
68
  if ga4_tracking
71
69
  ga4_data[:event_name] = cl_helper.get_ga4_event_name(nested_contents_item[:href]) if nested_contents_item[:href]
72
- ga4_data[:index] = {
73
- "index_link": index_link,
74
- }
70
+ ga4_data[:index_link] = index_link
75
71
  end
76
72
  %>
77
73
  <%= link_to_if !nested_contents_item[:active], nested_contents_item[:text], nested_contents_item[:href],
@@ -34,7 +34,7 @@
34
34
 
35
35
  ga4_tracking ||= false
36
36
  suggestion_data_attributes[:module] = "#{suggestion_data_attributes[:module]} ga4-link-tracker".strip if ga4_tracking
37
- suggestion_data_attributes[:ga4_link] = { event_name: "navigation", type: "intervention", section: suggestion_text, index: 1, index_total: 1 }.to_json if ga4_tracking
37
+ suggestion_data_attributes[:ga4_link] = { event_name: "navigation", type: "intervention", section: suggestion_text, index_link: 1, index_total: 1 }.to_json if ga4_tracking
38
38
  data_attributes[:ga4_intervention_banner] = "" if ga4_tracking # Added to the parent element for the GA4 pageview object to use
39
39
 
40
40
  suggestion_tag_options = {
@@ -107,11 +107,9 @@
107
107
  data-ga4-link="<%= {
108
108
  "event_name": "navigation",
109
109
  "section": "Licence",
110
- "index": {
111
- "index_section": layout_footer_helper.ga4_ogl_link_index_section.to_s,
112
- "index_link": "1",
113
- "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
114
- },
110
+ "index_section": layout_footer_helper.ga4_ogl_link_index_section.to_s,
111
+ "index_link": "1",
112
+ "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
115
113
  "text": "Open Government Licence v3.0",
116
114
  "index_total": "1",
117
115
  "type": "footer",
@@ -132,11 +130,9 @@
132
130
  data-ga4-link="<%= {
133
131
  "event_name": "navigation",
134
132
  "section": "Copyright",
135
- "index": {
136
- "index_section": layout_footer_helper.ga4_copyright_link_index_section.to_s,
137
- "index_link": "1",
138
- "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
139
- },
133
+ "index_section": layout_footer_helper.ga4_copyright_link_index_section.to_s,
134
+ "index_link": "1",
135
+ "index_section_count": layout_footer_helper.ga4_index_section_count.to_s,
140
136
  "text": "© Crown copyright",
141
137
  "index_total": "1",
142
138
  "type": "footer",
@@ -96,11 +96,9 @@
96
96
  "external": "false",
97
97
  "text": "GOV.UK",
98
98
  "section": "Logo",
99
- "index": {
100
- "index_link": 1,
101
- "index_section": 0,
102
- "index_section_count": 2,
103
- },
99
+ "index_link": 1,
100
+ "index_section": 0,
101
+ "index_section_count": 2,
104
102
  "index_total": 1
105
103
  }.to_json
106
104
  },
@@ -117,7 +115,7 @@
117
115
  },
118
116
  class: logotype_classes,
119
117
  height: "30",
120
- width: "36",
118
+ width: "36",
121
119
  focusable: "false",
122
120
  viewBox: "0 0 132 97",
123
121
  xmlns: "http://www.w3.org/2000/svg",
@@ -198,10 +196,8 @@
198
196
  event_name: "select_content",
199
197
  type: "header menu bar",
200
198
  text: link[:label],
201
- index: {
202
- index_section: 1,
203
- index_section_count: 2,
204
- },
199
+ index_section: 1,
200
+ index_section_count: 2,
205
201
  section: link[:label]
206
202
  }
207
203
  },
@@ -232,10 +228,8 @@
232
228
  "event_name": "select_content",
233
229
  "type": "header menu bar",
234
230
  "text": "Search",
235
- "index": {
236
- "index_section": 2,
237
- "index_section_count": 2,
238
- },
231
+ "index_section": 2,
232
+ "index_section_count": 2,
239
233
  "section": "Search"
240
234
  }.to_json
241
235
  }"
@@ -320,11 +314,9 @@
320
314
  ga4_link: {
321
315
  "event_name": "navigation",
322
316
  "type": "header menu bar",
323
- "index": {
324
- "index_section": column_index + 1,
325
- "index_link": index + 1,
326
- "index_section_count": 4,
327
- },
317
+ "index_section": column_index + 1,
318
+ "index_link": index + 1,
319
+ "index_section_count": 4,
328
320
  "index_total": index_total,
329
321
  "section": column[:label],
330
322
  }
@@ -395,11 +387,9 @@
395
387
  ga4_link: {
396
388
  "event_name": "navigation",
397
389
  "type": "header menu bar",
398
- "index": {
399
- "index_section": 4,
400
- "index_link": index + 1,
401
- "index_section_count": 4,
402
- },
390
+ "index_section": 4,
391
+ "index_link": index + 1,
392
+ "index_section_count": 4,
403
393
  "index_total": index_total,
404
394
  "section": popular_links_heading,
405
395
  }
@@ -54,9 +54,7 @@
54
54
  ga4_link_data = {
55
55
  'event_name': 'navigation',
56
56
  'type': 'share page',
57
- 'index': {
58
- 'index_link': index + 1,
59
- },
57
+ 'index_link': index + 1,
60
58
  'index_total': links.length,
61
59
  'text': link[:icon],
62
60
  }
@@ -65,9 +63,7 @@
65
63
  ga4_link_data = {
66
64
  'event_name': 'navigation',
67
65
  'type': 'follow us',
68
- 'index': {
69
- 'index_link': index + 1,
70
- },
66
+ 'index_link': index + 1,
71
67
  'index_total': links.length
72
68
  }
73
69
  end
@@ -84,10 +84,8 @@
84
84
  "ga4-link": {
85
85
  "event_name": "navigation",
86
86
  "type": "step by step",
87
- "index": {
88
- "index_section": step_index + 1,
89
- "index_section_count": steps.length
90
- },
87
+ "index_section": step_index + 1,
88
+ "index_section_count": steps.length,
91
89
  "section": step[:title]
92
90
  }.to_json
93
91
  }
@@ -26,6 +26,15 @@
26
26
  tracking_options ||= ({ dimension96: tracking_id }).to_json
27
27
  end
28
28
 
29
+ if ga4_tracking
30
+ ga4_data = {
31
+ event_name: "navigation",
32
+ type: "super breadcrumb",
33
+ index_link: "1",
34
+ index_total: "1",
35
+ }.to_json
36
+ end
37
+
29
38
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
30
39
  classes = %w[gem-c-step-nav-header]
31
40
  classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
@@ -44,7 +53,7 @@
44
53
  data-track-action="<%= tracking_action %>"
45
54
  data-track-label="<%= tracking_label %>"
46
55
  <% if ga4_tracking %>
47
- data-ga4-link='{"event_name":"navigation", "type":"super breadcrumb", "index":{"index_link": "1"}, "index_total":"1"}'
56
+ data-ga4-link='<%= ga4_data %>'
48
57
  <% end %>
49
58
  <% if tracking_dimension_enabled %>
50
59
  data-track-dimension="<%= tracking_dimension %>"
@@ -23,13 +23,11 @@
23
23
  data-track-dimension="<%= links[0][:text] %>"
24
24
  data-track-dimension-index="29"
25
25
  data-track-options='{"dimension96" : "<%= links[0][:tracking_id] %>" }'
26
- <% if ga4_tracking
26
+ <% if ga4_tracking
27
27
  ga4_attributes = {
28
28
  event_name: "navigation",
29
29
  type: "part of",
30
- index:{
31
- "index_link": "1"
32
- },
30
+ "index_link": "1",
33
31
  index_total: "1",
34
32
  section: pretitle,
35
33
  }.to_json
@@ -53,13 +51,11 @@
53
51
  data-track-dimension="<%= link[:text] %>"
54
52
  data-track-dimension-index="29"
55
53
  data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'
56
- <% if ga4_tracking
54
+ <% if ga4_tracking
57
55
  ga4_attributes = {
58
56
  event_name: "navigation",
59
57
  type: "part of",
60
- index:{
61
- "index_link": (index + 1).to_s
62
- },
58
+ index_link: (index + 1).to_s,
63
59
  index_total: (links.length).to_s,
64
60
  section: pretitle,
65
61
  }.to_json
@@ -34,10 +34,8 @@
34
34
  event_name: "select_content",
35
35
  type: "tabs",
36
36
  text: tab[:label],
37
- index: {
38
- index_section: index + 1,
39
- index_section_count: tabs.length,
40
- },
37
+ index_section: index + 1,
38
+ index_section_count: tabs.length,
41
39
  }
42
40
  ga4_attributes[:event_name] = "navigation" if as_links
43
41
  tab[:tab_data_attributes][:ga4_link] = ga4_attributes if as_links
@@ -1,4 +1,4 @@
1
- <%
1
+ <%
2
2
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
3
  title = t("components.related_navigation.ukraine.title")
4
4
  lang = shared_helper.t_locale("components.related_navigation.ukraine.title")
@@ -15,11 +15,9 @@
15
15
  ga4_attributes = {
16
16
  event_name: "navigation",
17
17
  type: "related content",
18
- index: {
19
- index_section: "#{ga4_tracking_counts.index_section_count}",
20
- index_link: "#{index + 1}",
21
- index_section_count: "#{ga4_tracking_counts.index_section_count}",
22
- },
18
+ index_section: "#{ga4_tracking_counts.index_section_count}",
19
+ index_link: "#{index + 1}",
20
+ index_section_count: "#{ga4_tracking_counts.index_section_count}",
23
21
  index_total: "#{index_total}",
24
22
  section: title,
25
23
  } if ga4_tracking
@@ -205,8 +205,8 @@ examples:
205
205
  <div class="govuk-!-width-full">
206
206
  <%= component %>
207
207
  </div>
208
- two_thirds_column:
209
- description: This variant is used for the featured section on the homepage, the aspect ratio used is 1:1
208
+ two_thirds:
209
+ description: This variant is used for the featured section on the homepage. The aspect ratio used is 1:1 and the width of the image is constrained to 80px wide.
210
210
  data:
211
211
  two_thirds: true
212
212
  href: "/still-not-a-page"
@@ -24,7 +24,7 @@
24
24
  <% end %>
25
25
 
26
26
  <ul class="gem-c-related-navigation__link-list">
27
- <%
27
+ <%
28
28
  constructed_link_array = []
29
29
  section_link_limit = related_nav_helper.calculate_section_link_limit(links)
30
30
  index_total = links.length
@@ -35,11 +35,9 @@
35
35
  ga4_attributes = {
36
36
  event_name: "navigation",
37
37
  type: ga4_type,
38
- index: {
39
- index_section: "#{section_index}",
40
- index_link: "#{index}",
41
- index_section_count: "#{section_count}",
42
- },
38
+ index_section: "#{section_index}",
39
+ index_link: "#{index}",
40
+ index_section_count: "#{section_count}",
43
41
  index_total: "#{index_total}",
44
42
  section: ga4_heading_text,
45
43
  } if ga4_tracking
@@ -70,7 +68,7 @@
70
68
 
71
69
  <% if links.length > section_link_limit %>
72
70
  <%
73
- classes = "gem-c-related-navigation__link toggle-wrap"
71
+ classes = "gem-c-related-navigation__link toggle-wrap"
74
72
  data_attributes_li = { module: "ga4-event-tracker" } if ga4_tracking
75
73
  data_attributes_link = {
76
74
  controls: "toggle_#{section_title}",
@@ -83,7 +81,7 @@
83
81
  <%= link_to("#", class: "gem-c-related-navigation__toggle", data: data_attributes_link) do %>
84
82
  <%= t("common.toggle_more",
85
83
  show: t('common.show'),
86
- number: related_nav_helper.remaining_link_count(links)) %>
84
+ number: related_nav_helper.remaining_link_count(links)) %>
87
85
  <% end %>
88
86
  <% end %>
89
87
 
@@ -61,9 +61,7 @@ module GovukPublishingComponents
61
61
  ga4_link: {
62
62
  event_name: "navigation",
63
63
  type: "breadcrumb",
64
- index: {
65
- index_link: index.to_s,
66
- },
64
+ index_link: index.to_s,
67
65
  index_total: breadcrumbs_length.to_s,
68
66
  },
69
67
  }
@@ -23,11 +23,9 @@ module GovukPublishingComponents
23
23
  {
24
24
  "event_name": "navigation",
25
25
  "type": "footer",
26
- "index": {
27
- "index_link": (index_link + 1).to_s,
28
- "index_section": (index_section + 1).to_s,
29
- "index_section_count": @ga4_index_section_count.to_s,
30
- },
26
+ "index_link": (index_link + 1).to_s,
27
+ "index_section": (index_section + 1).to_s,
28
+ "index_section_count": @ga4_index_section_count.to_s,
31
29
  "index_total": index_total.to_s,
32
30
  "section": section,
33
31
  }
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.19.0".freeze
2
+ VERSION = "35.20.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 35.19.0
4
+ version: 35.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -418,6 +418,7 @@ files:
418
418
  - app/assets/images/govuk_publishing_components/govuk-schema-placeholder-16x9.png
419
419
  - app/assets/images/govuk_publishing_components/govuk-schema-placeholder-1x1.png
420
420
  - app/assets/images/govuk_publishing_components/govuk-schema-placeholder-4x3.png
421
+ - app/assets/images/govuk_publishing_components/icon-close.svg
421
422
  - app/assets/images/govuk_publishing_components/icon-file-download.svg
422
423
  - app/assets/images/govuk_publishing_components/icon-important.svg
423
424
  - app/assets/images/govuk_publishing_components/icon-print-2x.png
@@ -450,6 +451,7 @@ files:
450
451
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js
451
452
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js
452
453
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js
454
+ - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js
453
455
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js
454
456
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js
455
457
  - app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-smart-answer-results-tracker.js