govuk_publishing_components 40.1.0 → 41.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -79
  3. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -34
  4. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -17
  5. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -6
  6. data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +0 -7
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +8 -74
  8. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -4
  9. data/app/assets/javascripts/govuk_publishing_components/domain-config.js +0 -8
  10. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -4
  11. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +0 -14
  12. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +0 -20
  13. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +0 -33
  14. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +0 -25
  15. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +192 -171
  16. data/app/assets/stylesheets/component_guide/application.scss +10 -11
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -1
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +2 -3
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +3 -3
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +1 -1
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -2
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +47 -22
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +3 -3
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-guidance.scss +1 -3
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -1
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_cross-service-header.scss +19 -19
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +14 -10
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +3 -3
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +2 -2
  30. data/app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss +1 -1
  31. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +8 -8
  32. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +16 -10
  33. data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +2 -2
  34. data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +2 -2
  35. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +33 -35
  36. data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +3 -3
  37. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +1 -1
  38. data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +1 -1
  39. data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +3 -3
  40. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +13 -3
  41. data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +1 -1
  42. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +6 -6
  43. data/app/assets/stylesheets/govuk_publishing_components/components/_reorderable-list.scss +2 -3
  44. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +4 -3
  45. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +2 -3
  46. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +3 -4
  47. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +3 -3
  48. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +10 -10
  49. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +1 -1
  50. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +1 -1
  51. data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +3 -3
  52. data/app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss +1 -1
  53. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +5 -4
  54. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +1 -1
  55. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +2 -2
  56. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +2 -2
  57. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +1 -1
  58. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -1
  59. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +5 -5
  60. data/app/views/govuk_publishing_components/components/_accordion.html.erb +1 -8
  61. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  62. data/app/views/govuk_publishing_components/components/_cards.html.erb +6 -11
  63. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -15
  64. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -19
  65. data/app/views/govuk_publishing_components/components/_details.html.erb +9 -11
  66. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -5
  67. data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -4
  68. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -21
  69. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -26
  70. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -5
  71. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -7
  72. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -10
  73. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +1 -3
  74. data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
  75. data/app/views/govuk_publishing_components/components/_select.html.erb +1 -2
  76. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -10
  77. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -1
  78. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
  79. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -24
  80. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -14
  81. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -4
  82. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
  83. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +1 -7
  84. data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -60
  85. data/app/views/govuk_publishing_components/components/docs/big_number.yml +2 -6
  86. data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +0 -1
  87. data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
  88. data/app/views/govuk_publishing_components/components/docs/cards.yml +41 -20
  89. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +0 -33
  90. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
  91. data/app/views/govuk_publishing_components/components/docs/details.yml +0 -15
  92. data/app/views/govuk_publishing_components/components/docs/document_list.yml +11 -18
  93. data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
  94. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -11
  95. data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -31
  96. data/app/views/govuk_publishing_components/components/docs/intervention.yml +0 -26
  97. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +2 -2
  98. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -2
  99. data/app/views/govuk_publishing_components/components/docs/option_select.yml +4 -16
  100. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +0 -15
  101. data/app/views/govuk_publishing_components/components/docs/print_link.yml +2 -9
  102. data/app/views/govuk_publishing_components/components/docs/select.yml +0 -36
  103. data/app/views/govuk_publishing_components/components/docs/share_links.yml +2 -4
  104. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +2 -25
  105. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +0 -23
  106. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +0 -10
  107. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -15
  108. data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
  109. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  110. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +3 -27
  111. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +1 -5
  112. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -2
  113. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +0 -10
  114. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  115. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -5
  116. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +0 -7
  117. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -19
  118. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -15
  119. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +2 -24
  120. data/lib/govuk_publishing_components/presenters/select_helper.rb +0 -4
  121. data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +0 -5
  122. data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +0 -7
  123. data/lib/govuk_publishing_components/version.rb +1 -1
  124. metadata +4 -26
  125. data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +0 -92
  126. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +0 -221
  127. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +0 -30
  128. data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +0 -55
  129. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +0 -133
  130. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +0 -46
  131. data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +0 -101
  132. data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +0 -51
  133. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +0 -88
  134. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -68
  135. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +0 -220
  136. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +0 -60
  137. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +0 -135
  138. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +0 -43
  139. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +0 -160
  140. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +0 -115
  141. data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +0 -39
  142. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +0 -132
  143. data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +0 -75
  144. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +0 -56
  145. data/app/assets/javascripts/govuk_publishing_components/analytics.js +0 -23
  146. data/app/assets/javascripts/govuk_publishing_components/components/details.js +0 -48
@@ -123,7 +123,7 @@ examples:
123
123
  - value: sombrero
124
124
  label: Sombrero
125
125
  id: sombrero
126
- with_tracking:
126
+ with_data_attributes_on_checkboxes:
127
127
  data:
128
128
  key: list_of_shoes
129
129
  title: List of shoes
@@ -133,29 +133,17 @@ examples:
133
133
  label: Trainers
134
134
  id: trainers
135
135
  data_attributes:
136
- track_category: "filterClicked"
137
- track_action: "List of shoes"
138
- track_label: "trainers"
139
- track_options:
140
- dimension28: 1
136
+ an_attribute: some_value1
141
137
  - value: plimsolls
142
138
  label: Plimsolls
143
139
  id: plimsolls
144
140
  data_attributes:
145
- track_category: "filterClicked"
146
- track_action: "List of shoes"
147
- track_label: "plimsolls"
148
- track_options:
149
- dimension28: 1
141
+ an_attribute: some_value2
150
142
  - value: high_heels
151
143
  label: High heels
152
144
  id: high_heels
153
145
  data_attributes:
154
- track_category: "filterClicked"
155
- track_action: "List of shoes"
156
- track_label: "high_heels"
157
- track_options:
158
- dimension28: 1
146
+ an_attribute: some_value3
159
147
  with_button_data_attributes:
160
148
  description: Allows data attributes to be passed to the component to be added to the expand/collapse button. The attributes are written to the parent element then read by the JavaScript and applied to the button. This is used for tracking purposes.
161
149
  data:
@@ -151,21 +151,6 @@ examples:
151
151
  image:
152
152
  url: 'https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/321/HMPS.jpg'
153
153
  alt_text: 'HM Prison Service'
154
- with_data_attributes:
155
- description: Data attributes can be applied as required. Note that the component does not include built in tracking. If this is required consider using the [track click script](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics/track-click.md).
156
- data:
157
- organisation:
158
- name: Cabinet Office
159
- url: '/government/organisations/cabinet-office'
160
- brand: cabinet-office
161
- crest: 'single-identity'
162
- data_attributes:
163
- track_category: "navOrganisationLinkClicked"
164
- track_action: 1
165
- track_label: '/government/organisations/cabinet-office'
166
- track_options:
167
- dimension28: 2
168
- dimension29: Cabinet Office
169
154
  without_a_link:
170
155
  data:
171
156
  organisation:
@@ -20,17 +20,10 @@ examples:
20
20
  description: |
21
21
  Data attributes can be passed to the component as shown.
22
22
 
23
- Note that the component does not include built in tracking. If this is required consider using the [track click script](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics/track-click.md).
23
+ Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
24
24
  data:
25
25
  data_attributes:
26
- track-category: "printButton"
27
- track-action: "clicked"
28
- track-label: "Print this page"
29
- with_custom_data_module:
30
- description: The component includes its own `data-module` but others can be passed in addition if required, for example to apply tracking to an element. This will be included along with the components own `data-module`.
31
- data:
32
- data_attributes:
33
- module: "gem-track-click"
26
+ an_attribute: some_value
34
27
  with_custom_margins:
35
28
  description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to having margin level `3` on top and bottom.
36
29
  data:
@@ -54,42 +54,6 @@ examples:
54
54
  value: option1
55
55
  - text: Something else
56
56
  value: option2
57
- with_tracking:
58
- description: |
59
- Tracking can be enabled on the select component by passing a minimum of `data_track_category` and `data_track_action`. Other tracking attributes are optional. Tracking is provided by the [track-select-change](https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js) module.
60
-
61
- Note: tracking events do not fire within the component guide.
62
- data:
63
- id: dropdown3
64
- label: With tracking enabled
65
- options:
66
- - text: Option one
67
- value: option1
68
- data_attributes:
69
- track_category: relatedLinkClicked
70
- track_action: 1.1
71
- track_label: /link-1
72
- track_options:
73
- dimension28: 1
74
- dimension29: Link 1
75
- - text: Option two
76
- value: option2
77
- data_attributes:
78
- track_category: relatedLinkClicked
79
- track_action: 1.2
80
- track_label: /link-2
81
- track_options:
82
- dimension28: 2
83
- dimension29: Link 2
84
- - text: Option three
85
- value: option3
86
- data_attributes:
87
- track_category: relatedLinkClicked
88
- track_action: 1.3
89
- track_label: /link-3
90
- track_options:
91
- dimension28: 3
92
- dimension29: Link 3
93
57
  with_data_attributes:
94
58
  description: Other data attributes can be passed to the component if needed.
95
59
  data:
@@ -47,7 +47,7 @@ examples:
47
47
  context:
48
48
  right_to_left: true
49
49
  with_data_attributes:
50
- description: Data attributes can be added to both the parent element and the individual share links, as shown. Note that the component defaults to having a `data-module` of `gem-track-click`, but this is preserved even if another value for module is passed.
50
+ description: Data attributes can be added to both the parent element and the individual share links, as shown. Note that the component defaults to having a `data-module` of `ga4-link-tracker` if tracking is enabled, but this is preserved even if another value for module is passed.
51
51
  data:
52
52
  data_attributes:
53
53
  module: 'example-passed-module'
@@ -91,7 +91,7 @@ examples:
91
91
  hidden_text: '',
92
92
  icon: 'twitter'
93
93
  }
94
- ]
94
+ ]
95
95
  with_custom_visually_hidden_text:
96
96
  description: |
97
97
  Use this option to specify a visually hidden text for screenreaders to prepend to the link text.
@@ -108,8 +108,6 @@ examples:
108
108
  ]
109
109
  track_as_sharing_links:
110
110
  description: |
111
- Where the component is used to allow users to share content on social media, tracking can be added that uses [Social Interactions](https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions) in UA.
112
- If this option is not included, it is assumed the component is simply linking to social media pages and the extra options are omitted from the tracking call in UA.
113
111
  In GA4, when this is set to true, a JSON is added to a data-attribute called data-ga4-link, which is detected by ga4-link-tracker.js and pushed to the dataLayer.
114
112
  Most of the tracking values are added by default, but if you need to add more GA4 values or override defaults, you can pass a ga4_extra_data object.
115
113
  data:
@@ -122,29 +122,6 @@ examples:
122
122
  ]
123
123
  },
124
124
  ]
125
- with_unique_tracking:
126
- description: |
127
- In order to identify the step by step navigation the component is part of, we need to track a unique ID of the navigation in Universal Analytics. This ID should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the ID of the step nav page.
128
-
129
- This includes show/hide all, show/hide step and any link clicks.
130
- data:
131
- tracking_id: 'this-is-the-tracking-id'
132
- steps: [
133
- {
134
- title: 'Unique tracking id',
135
- contents: [
136
- {
137
- type: 'list',
138
- contents: [
139
- {
140
- href: '#',
141
- text: 'This is a link'
142
- }
143
- ]
144
- }
145
- ]
146
- }
147
- ]
148
125
  with_a_different_heading_level:
149
126
  description: Steps have a `h2` by default, but this can be changed. The heading level does not change any styling.
150
127
  data:
@@ -573,8 +550,8 @@ examples:
573
550
  description: |
574
551
  Steps can be optional. This is controlled by two parameters, 'optional' and 'logic'.
575
552
 
576
- - Optional steps used to have a dotted line down the side but this was removed as it confused users. In some cases we may still need to record if a step is optional, so if this parameter is applied, Google Analytics tracking events will have 'optional' appended to the end of the eventLabel.
577
- - Logic will change the number next to a step to the word 'and' or the word 'or'.
553
+ - Optional steps used to have a dotted line down the side but this was removed as it confused users
554
+ - Logic will change the number next to a step to the word 'and' or the word 'or'
578
555
 
579
556
  If a step is optional this should be conveyed by the text within that step.
580
557
  data:
@@ -28,29 +28,6 @@ examples:
28
28
  data:
29
29
  title: 'Learn to practice flexible spacing: step by step'
30
30
  margin_bottom: 9
31
- with_unique_tracking:
32
- description: In order to identify the step by step navigation the component is part of, we need to track a unique `ID` of the navigation in Google Analytics. This `ID` should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the `ID` of the step nav that the component links to.
33
- data:
34
- title: 'With a tracking id'
35
- path: '#'
36
- tracking_id: 'this-is-the-tracking-id'
37
- with_custom_tracking:
38
- data:
39
- title: 'With a custom tracking'
40
- path: '#'
41
- tracking_category: "customTrackingCategoryClicked"
42
- tracking_action: "customTrackingAction"
43
- tracking_label: "customTrackingLabel"
44
- tracking_dimension: "customTrackingDimension"
45
- tracking_dimension_index: "23"
46
- without_custom_dimension:
47
- data:
48
- title: 'Without custom dimensions'
49
- path: '#'
50
- tracking_category: "customTrackingCategoryClicked"
51
- tracking_action: "customTrackingAction"
52
- tracking_label: "customTrackingLabel"
53
- tracking_dimension_enabled: false
54
31
  without_ga4_tracking:
55
32
  description: Disables GA4 tracking on the header. Tracking is enabled by default. This includes the `ga4-link-tracker` module and `data-ga4-link` attributes. See the [ga4-link-tracker docs](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
56
33
  data:
@@ -52,16 +52,6 @@ examples:
52
52
  text: 'Learn to drive a motorbike: step by step'
53
53
  }
54
54
  ]
55
- with_unique_tracking:
56
- description: In order to identify the step by step navigation the component is part of, we need to track a unique ID of the navigation in Google Analytics. This ID should be the same across all pages that are linked from and are part of that navigation. Its value is included in any tracking events, specifically in dimension96. It refers to the ID of the step nav that the component links to. Where there are multiple links, they will have different tracking IDs.
57
- data:
58
- links: [
59
- {
60
- href: '#',
61
- text: 'With a tracking id',
62
- tracking_id: 'this-is-the-tracking-id'
63
- }
64
- ]
65
55
  always_display_as_a_list:
66
56
  description: |
67
57
  when this component is rendered alongside an expanded step by step, we want it to render as a heading.
@@ -51,28 +51,16 @@ examples:
51
51
  brand: 'attorney-generals-office'
52
52
  email_signup_link: '/foreign-travel-advice/singapore/email-signup'
53
53
  feed_link: '/foreign-travel-advice/singapore.atom'
54
- with_tracking:
54
+ with_data_attributes_on_links:
55
55
  description: Data attributes can be passed for each link as shown.
56
56
  data:
57
57
  email_signup_link: '/foreign-travel-advice/singapore/email-signup'
58
58
  email_signup_link_data_attributes: {
59
- track_category: 'email_link_category',
60
- track_action: 1.1,
61
- track_label: 'email_link_label',
62
- track_options: {
63
- dimension28: 1,
64
- dimension29: 'dimension29EmailLink'
65
- }
59
+ an_attribute: some_value
66
60
  }
67
61
  feed_link_box_value: 'https://www.gov.uk/government/organisations/attorney-generals-office.atom'
68
62
  feed_link_data_attributes: {
69
- track_category: 'feed_link_category',
70
- track_action: 1.2,
71
- track_label: 'feed_link_label',
72
- track_options: {
73
- dimension28: 7,
74
- dimension29: 'dimension29feedLink'
75
- }
63
+ an_attribute: some_value
76
64
  }
77
65
  as_small_form:
78
66
  data:
@@ -92,7 +92,7 @@ examples:
92
92
 
93
93
  The example shown applies a tracking attribute specifically for use by Google Tag Manager in [Content Publisher](https://github.com/alphagov/content-publisher).
94
94
 
95
- Other data attributes can also be applied as required. Note that the component does not include built in tracking. If this is required consider using the [track click script](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics/track-click.md).
95
+ Other data attributes can also be applied as required. Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
96
96
  data:
97
97
  sortable: true
98
98
  head:
@@ -78,7 +78,7 @@ examples:
78
78
  description: |
79
79
  The example shown applies a tracking attribute specifically for use by Google Tag Manager in [Content Publisher](https://github.com/alphagov/content-publisher).
80
80
 
81
- Other data attributes can also be applied as required. Note that the component does not include built in tracking. If this is required consider using the [track click script](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics/track-click.md).
81
+ Other data attributes can also be applied as required. Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
82
82
  data:
83
83
  tabs:
84
84
  - id: "tab-with-data-attributes-1"
@@ -84,7 +84,7 @@ examples:
84
84
  - locale: 'cy'
85
85
  base_path: '/cy'
86
86
  text: 'Cymraeg'
87
- with_tracking:
87
+ with_data_attributes_on_links:
88
88
  description: Data attributes can be passed for each link as shown.
89
89
  data:
90
90
  translations:
@@ -93,22 +93,12 @@ examples:
93
93
  text: 'English'
94
94
  active: true
95
95
  data_attributes:
96
- track_category: 'categoryEnglish'
97
- track_action: 1.1
98
- track_label: 'labelEnglish'
99
- track_options:
100
- dimension28: 1
101
- dimension29: 'dimension29English'
96
+ an_attribute: some_value1
102
97
  - locale: 'cy'
103
98
  base_path: '/cy'
104
99
  text: 'Cymraeg'
105
100
  data_attributes:
106
- track_category: 'categoryWelsh'
107
- track_action: 1.2
108
- track_label: 'labelWelsh'
109
- track_options:
110
- dimension28: 1
111
- dimension29: 'dimension29Welsh'
101
+ an_attribute: some_value2
112
102
  inverse:
113
103
  data:
114
104
  inverse: true
@@ -117,22 +107,8 @@ examples:
117
107
  base_path: '/en'
118
108
  text: 'English'
119
109
  active: true
120
- data_attributes:
121
- track_category: 'categoryEnglish'
122
- track_action: 1.1
123
- track_label: 'labelEnglish'
124
- track_options:
125
- dimension28: 1
126
- dimension29: 'dimension29English'
127
110
  - locale: 'cy'
128
111
  base_path: '/cy'
129
112
  text: 'Cymraeg'
130
- data_attributes:
131
- track_category: 'categoryWelsh'
132
- track_action: 1.2
133
- track_label: 'labelWelsh'
134
- track_options:
135
- dimension28: 1
136
- dimension29: 'dimension29Welsh'
137
113
  context:
138
114
  dark_background: true
@@ -5,8 +5,6 @@
5
5
  <form action="<%= absolute_links_helper.make_url_absolute('/contact/govuk/problem_reports') %>"
6
6
  id="something-is-wrong"
7
7
  class="gem-c-feedback__form js-feedback-form"
8
- data-track-category="Onsite Feedback"
9
- data-track-action="GOV.UK Send Form"
10
8
  method="post"
11
9
  hidden>
12
10
 
@@ -43,7 +41,7 @@
43
41
  } %>
44
42
 
45
43
  <%
46
- unless disable_ga4
44
+ unless disable_ga4
47
45
  heading_text = t("components.feedback.help_us_improve_govuk", locale: :en)
48
46
  ga4_submit_button_event = {
49
47
  event_name: "form_submit",
@@ -64,8 +62,6 @@
64
62
 
65
63
  <button
66
64
  class="govuk-button govuk-button--secondary gem-c-feedback__close gem-c-feedback__js-show js-close-form"
67
- data-track-category="Onsite Feedback"
68
- data-track-action="GOV.UK Close Form"
69
65
  aria-controls="something-is-wrong"
70
66
  aria-expanded="true">
71
67
  <%= t("components.feedback.close") %>
@@ -14,8 +14,6 @@
14
14
  </p>
15
15
  <button
16
16
  class="govuk-button govuk-button--secondary js-close-form"
17
- data-track-category="yesNoFeedbackForm"
18
- data-track-action="ffFormClose"
19
17
  aria-controls="page-is-not-useful"
20
18
  aria-expanded="true"
21
19
  hidden>
@@ -37,10 +37,6 @@
37
37
  <% # Maybe button exists only to try and capture clicks by bots %>
38
38
  <%= link_to "/contact/govuk", {
39
39
  class: 'gem-c-feedback__prompt-link',
40
- data: {
41
- 'track-category' => 'yesNoFeedbackForm',
42
- 'track-action' => 'ffMaybeClick'
43
- },
44
40
  role: 'button',
45
41
  hidden: 'hidden',
46
42
  'aria-hidden': 'true',
@@ -52,8 +48,6 @@
52
48
  <%= tag.button(
53
49
  class: "govuk-button gem-c-feedback__prompt-link js-page-is-useful",
54
50
  data: {
55
- track_category: "yesNoFeedbackForm",
56
- track_action: "ffYesClick",
57
51
  ga4_event: ga4_yes_button_event,
58
52
  }) do %>
59
53
  <%= t("components.feedback.yes") %> <span class="govuk-visually-hidden"><%= t("components.feedback.is_useful") %></span>
@@ -68,8 +62,6 @@
68
62
  expanded: "false",
69
63
  },
70
64
  data: {
71
- track_category: "yesNoFeedbackForm",
72
- track_action: "ffNoClick",
73
65
  ga4_event: ga4_no_button_event,
74
66
  }) do %>
75
67
  <%= t("components.feedback.no") %> <span class="govuk-visually-hidden"><%= t("components.feedback.is_not_useful") %></span>
@@ -91,8 +83,6 @@
91
83
  controls: "something-is-wrong"
92
84
  },
93
85
  data: {
94
- track_category: "Onsite Feedback",
95
- track_action: "GOV-UK Open Form",
96
86
  ga4_event: ga4_problem_button_event,
97
87
  }) do %>
98
88
  <%= t("components.feedback.something_wrong") %>
@@ -1,5 +1,5 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
- <a href="<%= logo_link %>" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
2
+ <a href="<%= logo_link %>" class="govuk-header__link govuk-header__link--homepage">
3
3
  <svg
4
4
  focusable="false"
5
5
  role="img"
@@ -20,10 +20,5 @@
20
20
  margin_bottom: 0,
21
21
  no_border: true,
22
22
  disable_corrections: true,
23
- data_attributes: {
24
- track_category: "headerClicked",
25
- track_action: "searchSubmitted",
26
- track_label: "none",
27
- },
28
23
  } %>
29
24
  </form>
@@ -48,13 +48,6 @@
48
48
  rel: link[:rel],
49
49
  lang: shared_helper.t_locale_check(link[:locale]),
50
50
  data: {
51
- track_category: 'relatedLinkClicked',
52
- track_action: "#{section_index}.#{index} #{related_nav_helper.construct_section_text(section_title, true) || t('components.related_navigation.related_content')}",
53
- track_label: link[:path],
54
- track_options: {
55
- dimension28: links.length.to_s,
56
- dimension29: link[:text]
57
- },
58
51
  ga4_link: ga4_attributes,
59
52
  }
60
53
  )
@@ -50,14 +50,7 @@ module GovukPublishingComponents
50
50
  end
51
51
 
52
52
  def tracking_data(breadcrumbs_length)
53
- data = {
54
- track_category: "breadcrumbClicked",
55
- track_action: index,
56
- track_label: path,
57
- track_options: {
58
- dimension28: breadcrumbs_length.to_s,
59
- dimension29: crumb[:title],
60
- },
53
+ {
61
54
  ga4_link: {
62
55
  event_name: "navigation",
63
56
  type: "breadcrumb",
@@ -65,17 +58,6 @@ module GovukPublishingComponents
65
58
  index_total: breadcrumbs_length.to_s,
66
59
  },
67
60
  }
68
-
69
- is_homepage = crumb[:url] == "/"
70
-
71
- if is_homepage
72
- data[:track_category] = "homeLinkClicked"
73
- data[:track_action] = "homeBreadcrumb"
74
- data[:track_label] = ""
75
- data[:track_options] = "{}"
76
- end
77
-
78
- data
79
61
  end
80
62
 
81
63
  private
@@ -4,11 +4,10 @@ module GovukPublishingComponents
4
4
  include ActionView::Helpers
5
5
  include ActionView::Context
6
6
 
7
- attr_reader :href_data_attributes, :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :youtube_video_id, :image_src, :two_thirds, :large_font_size_mobile
7
+ attr_reader :extra_details, :extra_details_no_indent, :heading_text, :metadata, :lang, :image_loading, :youtube_video_id, :image_src, :two_thirds, :large_font_size_mobile
8
8
 
9
9
  def initialize(local_assigns, brand_helper)
10
10
  @href = local_assigns[:href]
11
- @href_data_attributes = local_assigns[:href_data_attributes]
12
11
  @extra_details = local_assigns[:extra_details] || []
13
12
  @image_src = local_assigns[:image_src]
14
13
  @image_alt = local_assigns[:image_alt] || ""
@@ -51,17 +50,6 @@ module GovukPublishingComponents
51
50
  @two_thirds && @large_font_size_mobile
52
51
  end
53
52
 
54
- def is_tracking?
55
- return true if @href_data_attributes
56
-
57
- if @extra_details
58
- @extra_details.each do |link|
59
- return true if link[:data_attributes]
60
- end
61
- end
62
- false
63
- end
64
-
65
53
  def media
66
54
  return youtube_link if @youtube_video_id
67
55
 
@@ -147,8 +135,6 @@ module GovukPublishingComponents
147
135
  href,
148
136
  {
149
137
  class: "govuk-body govuk-link gem-c-image-card__youtube-thumbnail-container js-youtube-card-embed",
150
- "data-youtube-player-analytics": true,
151
- "data-youtube-player-analytics-category": "EmbeddedYoutube",
152
138
  },
153
139
  ) do
154
140
  youtube_thumbnail
@@ -3,7 +3,6 @@ module GovukPublishingComponents
3
3
  class PublicLayoutHelper
4
4
  BLUE_BAR_BACKGROUND_COLOURS = %w[browse].freeze
5
5
  FOOTER_NAVIGATION_COLUMNS = [2, 1].freeze
6
- FOOTER_TRACK_ACTIONS = %w[topicsLink governmentactivityLink].freeze
7
6
  FOOTER_META = {
8
7
  items: [
9
8
  {
@@ -48,7 +47,7 @@ module GovukPublishingComponents
48
47
 
49
48
  def initialize(local_assigns)
50
49
  @footer_navigation = local_assigns[:footer_navigation] || navigation_link_generation_from_locale(I18n.t("components.layout_footer.navigation_links"))
51
- @footer_meta = local_assigns[:footer_meta] || { items: add_data_attributes_to_links(FOOTER_META[:items], "supportLink") }
50
+ @footer_meta = local_assigns[:footer_meta] || { items: FOOTER_META[:items] }
52
51
  @cookie_banner_data = local_assigns[:cookie_banner_data] || {}
53
52
  end
54
53
 
@@ -57,7 +56,7 @@ module GovukPublishingComponents
57
56
  {
58
57
  title: menu[:title],
59
58
  columns: footer_navigation_columns[i],
60
- items: add_data_attributes_to_links(menu[:menu_contents], footer_track_actions[i]),
59
+ items: menu[:menu_contents],
61
60
  }
62
61
  end
63
62
  end
@@ -66,30 +65,9 @@ module GovukPublishingComponents
66
65
  FOOTER_NAVIGATION_COLUMNS
67
66
  end
68
67
 
69
- def footer_track_actions
70
- FOOTER_TRACK_ACTIONS
71
- end
72
-
73
68
  def blue_bar_background_colours
74
69
  BLUE_BAR_BACKGROUND_COLOURS
75
70
  end
76
-
77
- def generate_data_attribute(link, track_action)
78
- {
79
- track_category: "footerClicked",
80
- track_action:,
81
- track_label: link[:href],
82
- track_options: {
83
- dimension29: link[:text],
84
- },
85
- }
86
- end
87
-
88
- def add_data_attributes_to_links(items, track_action)
89
- items.map do |item|
90
- item.deep_merge({ attributes: { data: generate_data_attribute(item, track_action) } })
91
- end
92
- end
93
71
  end
94
72
  end
95
73
  end
@@ -15,10 +15,6 @@ module GovukPublishingComponents
15
15
  @describedby = get_describedby
16
16
  end
17
17
 
18
- def data_tracking?
19
- @options.any? { |item| item[:data_attributes] && item[:data_attributes][:track_category] && item[:data_attributes][:track_action] }
20
- end
21
-
22
18
  def css_classes
23
19
  classes = %w[govuk-form-group gem-c-select]
24
20
  classes << "govuk-form-group--error" if @error_message
@@ -19,12 +19,7 @@ module GovukPublishingComponents
19
19
  end
20
20
 
21
21
  def data
22
- @data_attributes[:track_label] = base_path
23
- # data-action for tracking should have the format of e.g. "Unsubscribe-button-top", or "Subscribe-button-bottom"
24
- # when button_location is not present data-action will fall back to "Unsubscribe-button"/"Subscribe-button"
25
- @data_attributes[:track_action] = [button_type, "button", button_location].compact.join("-")
26
22
  @data_attributes[:module] = "single-page-notification-button" if js_enhancement
27
- @data_attributes[:track_category] = "Single-page-notification-button"
28
23
  # This attribute is passed through to the personalisation API to ensure when a new button is returned from the API, it has the same button_location
29
24
  @data_attributes[:button_location] = button_location
30
25
  @data_attributes[:button_text_subscribe] = @button_text_subscribe
@@ -14,13 +14,6 @@ module GovukPublishingComponents
14
14
  true if @translations.length > 1
15
15
  end
16
16
 
17
- def tracking_is_present?
18
- @translations.each do |translation|
19
- return true if translation[:data_attributes]
20
- end
21
- false
22
- end
23
-
24
17
  def classes
25
18
  classes = %w[gem-c-translation-nav]
26
19
  classes << inverse_class if @inverse
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "40.1.0".freeze
2
+ VERSION = "41.1.0".freeze
3
3
  end