govuk_publishing_components 40.1.0 → 41.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) 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/views/govuk_publishing_components/components/_accordion.html.erb +1 -8
  16. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  17. data/app/views/govuk_publishing_components/components/_cards.html.erb +3 -11
  18. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -15
  19. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +3 -19
  20. data/app/views/govuk_publishing_components/components/_details.html.erb +9 -11
  21. data/app/views/govuk_publishing_components/components/_image_card.html.erb +1 -5
  22. data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -4
  23. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -21
  24. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +1 -26
  25. data/app/views/govuk_publishing_components/components/_metadata.html.erb +2 -5
  26. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +2 -7
  27. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -10
  28. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +1 -3
  29. data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
  30. data/app/views/govuk_publishing_components/components/_select.html.erb +1 -2
  31. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -10
  32. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +0 -1
  33. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +1 -1
  34. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +1 -24
  35. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -14
  36. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -4
  37. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
  38. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +1 -7
  39. data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -60
  40. data/app/views/govuk_publishing_components/components/docs/big_number.yml +2 -6
  41. data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +0 -1
  42. data/app/views/govuk_publishing_components/components/docs/button.yml +1 -1
  43. data/app/views/govuk_publishing_components/components/docs/cards.yml +3 -13
  44. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +0 -33
  45. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
  46. data/app/views/govuk_publishing_components/components/docs/details.yml +0 -15
  47. data/app/views/govuk_publishing_components/components/docs/document_list.yml +11 -18
  48. data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
  49. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -11
  50. data/app/views/govuk_publishing_components/components/docs/image_card.yml +0 -31
  51. data/app/views/govuk_publishing_components/components/docs/intervention.yml +0 -26
  52. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +2 -2
  53. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +0 -2
  54. data/app/views/govuk_publishing_components/components/docs/option_select.yml +4 -16
  55. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +0 -15
  56. data/app/views/govuk_publishing_components/components/docs/print_link.yml +2 -9
  57. data/app/views/govuk_publishing_components/components/docs/select.yml +0 -36
  58. data/app/views/govuk_publishing_components/components/docs/share_links.yml +2 -4
  59. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +2 -25
  60. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +0 -23
  61. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +0 -10
  62. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -15
  63. data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
  64. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  65. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +3 -27
  66. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +1 -5
  67. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +0 -2
  68. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +0 -10
  69. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  70. data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +0 -5
  71. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +0 -7
  72. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -19
  73. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -15
  74. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +2 -24
  75. data/lib/govuk_publishing_components/presenters/select_helper.rb +0 -4
  76. data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +0 -5
  77. data/lib/govuk_publishing_components/presenters/translation_nav_helper.rb +0 -7
  78. data/lib/govuk_publishing_components/version.rb +1 -1
  79. metadata +1 -23
  80. data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +0 -92
  81. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +0 -221
  82. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +0 -30
  83. data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +0 -55
  84. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +0 -133
  85. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +0 -46
  86. data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +0 -101
  87. data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +0 -51
  88. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +0 -88
  89. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -68
  90. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +0 -220
  91. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +0 -60
  92. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +0 -135
  93. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +0 -43
  94. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +0 -160
  95. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +0 -115
  96. data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +0 -39
  97. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +0 -132
  98. data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +0 -75
  99. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +0 -56
  100. data/app/assets/javascripts/govuk_publishing_components/analytics.js +0 -23
  101. data/app/assets/javascripts/govuk_publishing_components/components/details.js +0 -48
@@ -2,8 +2,7 @@
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")
5
- data_module = "gem-track-click"
6
- data_module << " ga4-link-tracker" unless disable_ga4
5
+ data_module = "ga4-link-tracker" unless disable_ga4
7
6
  %>
8
7
  <%= tag.div class: "gem-c-contextual-sidebar__cta gem-c-contextual-sidebar__cta--ukraine", data: { module: data_module } do %>
9
8
  <%= tag.h2 title, class: "gem-c-contextual-sidebar__heading govuk-heading-s" %>
@@ -26,11 +25,6 @@
26
25
  link[:href],
27
26
  class: "govuk-link",
28
27
  data: {
29
- "track-category": "relatedLinkClicked",
30
- "track-action": "1.0 Invasion of Ukraine",
31
- "track-label": link[:href],
32
- "track-dimension": link[:label],
33
- "track-dimension-index": "29",
34
28
  ga4_link: ga4_attributes,
35
29
  },
36
30
  lang: lang %>
@@ -199,16 +199,10 @@ examples:
199
199
  description: |
200
200
  Adds custom data attributes to each section of the accordion. Accepts a hash, so multiple attributes can be added.
201
201
 
202
- The `data_attributes` option applies attributes to the outermost element in the accordion. Each item can also have a `data_attributes` hash, which are placed on the `button` that triggers the opening and closing - useful for differentiating between each section of the accordion.
203
-
204
- Data attributes can be added to the 'Show/hide all' link using the `data_attributes_show_all` option, primarily where custom tracking is required. These attributes are read from the accordion markup and then added to the link by JavaScript (which is how the link is created). Currently, this is only used for tracking with Universal Analytics.
205
-
206
- If `track_options` within `data_attributes_show_all` is set, then it is possible to pass a custom dimension when 'Show/Hide all' is clicked.
202
+ The `data_attributes` option applies attributes to the outermost element in the accordion. Individual items can also have their own `data_attributes` hash, which are placed on the `button` that triggers the opening and closing of that section - useful for differentiating between each section of the accordion.
207
203
  data:
208
204
  data_attributes:
209
205
  custom_data_attr: custom-data-attr-accordion
210
- data_attributes_show_all:
211
- tracking-options: "{ 'dimension114': 1 }"
212
206
  items:
213
207
  - heading:
214
208
  text: Writing well for the web
@@ -234,20 +228,6 @@ examples:
234
228
  html: <p class="govuk-body">This is the content for How people read.</p>
235
229
  data_attributes:
236
230
  custom_data_attr: custom-data-attr-accordion-item-4
237
- with_custom_data_module:
238
- 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`.
239
- data:
240
- data_attributes:
241
- module: gem-track-click
242
- items:
243
- - heading:
244
- text: Writing well for the web
245
- content:
246
- html: <p class="govuk-body">This is the content for Writing well for the web.</p>
247
- - heading:
248
- text: Writing well for specialists
249
- content:
250
- html: <p class="govuk-body">This is the content for Writing well for specialists.</p>
251
231
  different_heading_level:
252
232
  description: This will alter the level of the heading, not the appearance of the heading.
253
233
  data:
@@ -339,42 +319,3 @@ examples:
339
319
  text: How people read
340
320
  content:
341
321
  html: <p class="govuk-body">This is the content for How people read.</p>
342
- with_track_show_all_clicks:
343
- description: |
344
- To switch on Google Analytics for the "Show all sections" button on click, pass `track_show_all_clicks: true` the values passed on open will be
345
- `Event Action: accordionOpened` `Event Category: pageElementInteraction` `Event Label: Show all sections`
346
- data:
347
- track_show_all_clicks: true
348
- items:
349
- - heading:
350
- text: Writing well for the web
351
- id: writing-well-for-the-web-2
352
- content:
353
- html: <p class="govuk-body">This is content for accordion 1 of 2</p>
354
- - heading:
355
- text: Writing well for specialists
356
- content:
357
- html: <p class="govuk-body">This is content for accordion 2 of 2</p>
358
- with_track_sections:
359
- description: |
360
- To switch on Google Analytics for each section, on click, pass `track_sections: true` the values passed on open will be
361
- `Event Action: accordionOpened` / `accordionClosed` `Event Category: pageElementInteraction` and the `Event Label` being the heading text.
362
-
363
- If `track_options` in an item is set, then it is possible to pass a custom dimension when the section is clicked.
364
-
365
- (`track_show_all_clicks: true` can be added to track the "Show all sections" button as well, if required)
366
- data:
367
- track_sections: true
368
- items:
369
- - heading:
370
- text: Writing well for the web
371
- id: writing-well-for-the-web-3
372
- content:
373
- html: <p class="govuk-body">This is content for accordion 1 of 2</p><p class="govuk-body">This content contains a <a href="#anchor-nav-test" class="govuk-link">link</a></p>
374
- data_attributes:
375
- track_options:
376
- dimension114: 1
377
- - heading:
378
- text: Writing well for specialists
379
- content:
380
- html: <p class="govuk-body" id="anchor-nav-test">This is content for accordion 2 of 2</p>
@@ -37,17 +37,13 @@ examples:
37
37
  description: |
38
38
  If a `href` attribute is present, `data_attributes` will apply to the `span` containing the number value (see below).
39
39
 
40
- 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).
40
+ 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).
41
41
  data:
42
42
  number: 23
43
43
  label: Ministerial departments
44
44
  href: "/government/organisations#ministerial_departments"
45
45
  data_attributes:
46
- track-category: homepageClicked
47
- track-action: departmentsLink
48
- track-label: "/government/organisations#ministerial_departments"
49
- track-dimension: 23 Ministerial departments
50
- track-dimension-index: 29
46
+ department-count: true
51
47
  with_data_attributes_but_no_link:
52
48
  data:
53
49
  number: 23
@@ -2,7 +2,6 @@ name: "Breadcrumbs"
2
2
  description: "Navigational breadcrumbs, showing page hierarchy"
3
3
  body: |
4
4
  Accepts an array of breadcrumb objects. Each crumb must have a title and a URL.
5
- Links are tracked, but in Universal Analytics, links to the homepage (any link with a url of `/`) will be tracked separately as `homeLinkClicked`.
6
5
 
7
6
  We recommend that if using the breadcrumbs for navigation purposes, you set `collapse_on_mobile` to `true` to make things more readable for mobile users. However, you can specify `collapse_on_mobile:``false` or remove the flag completely to stop this behaviour.
8
7
  shared_accessibility_criteria:
@@ -97,7 +97,7 @@ examples:
97
97
  start: true
98
98
  href: '#'
99
99
  with_data_attributes:
100
- 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).
100
+ 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 [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
101
101
  data:
102
102
  text: Track this!
103
103
  margin_bottom: true
@@ -121,28 +121,18 @@ examples:
121
121
  description: |
122
122
  Data attributes can be passed to individual links within the component as shown.
123
123
 
124
- 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).
124
+ 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).
125
125
  data:
126
126
  items:
127
127
  - link:
128
128
  text: Benefits
129
129
  path: http://www.gov.uk
130
130
  data_attributes:
131
- track_category: homepageClicked
132
- track_action: track-action
133
- track_label: track-label
134
- track_dimension: track-dimension
135
- track_dimension_index: 29
136
- track_value: 9
131
+ an_attribute: some_value
137
132
  description: Includes eligibility, appeals, tax credits and Universal Credit
138
133
  - link:
139
134
  text: Births, deaths, marriages and&nbsp;care
140
135
  path: http://www.gov.uk
141
136
  data_attributes:
142
- track_category: homepageClicked
143
- track_action: track-action
144
- track_label: track-label
145
- track_dimension: track-dimension
146
- track_dimension_index: 29
147
- track_value: 9
137
+ an_attribute: some_value
148
138
  description: Parenting, civil partnerships, divorce and Lasting Power of Attorney
@@ -200,39 +200,6 @@ examples:
200
200
  value: green
201
201
  - label: Blue
202
202
  value: blue
203
- checkboxes_with_data_attributes:
204
- description: Data attributes for tracking can be applied as shown. Custom JavaScript in the component will fire identical tracking events on check and uncheck. See below to send different events on uncheck.
205
- data:
206
- name: With tracking
207
- items:
208
- - label: Tracked
209
- value: tracked
210
- data_attributes: {
211
- track_category: checkboxClicked,
212
- track_label: /news-and-communications,
213
- track_action: news,
214
- track_options: {
215
- dimension28: 2,
216
- dimension29: Tracked
217
- }
218
- }
219
- checkboxes_with_data_attributes_and_custom_uncheck_event_category:
220
- description: Data attributes for tracking can be applied as shown. Custom JavaScript in the component will fire different tracking events on check and uncheck.
221
- data:
222
- name: With tracking and a custom uncheck category
223
- items:
224
- - label: Tracked
225
- value: tracked
226
- data_attributes: {
227
- track_category: checkboxClicked,
228
- untrack_category: checkboxUnchecked,
229
- track_label: /news-and-communications,
230
- track_action: news,
231
- track_options: {
232
- dimension28: 2,
233
- dimension29: Tracked
234
- }
235
- }
236
203
  with_aria_controls_attributes:
237
204
  description: Aria controls attributes are applied to the checkboxes only if JavaScript is enabled.
238
205
  data:
@@ -41,11 +41,11 @@ examples:
41
41
  "yes":
42
42
  text: "Yes"
43
43
  data_attributes:
44
- track-category: cookieBanner
44
+ an_attribute: some_value1
45
45
  "no":
46
46
  text: "No"
47
47
  data_attributes:
48
- "track-category": "cookieBanner"
48
+ an_attribute: some_value2
49
49
  cookie_preferences:
50
50
  text: How we use cookies
51
51
  href: "/cookies"
@@ -21,21 +21,6 @@ examples:
21
21
  title: Help with nationality
22
22
  block: |
23
23
  We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.
24
- with_data_attributes:
25
- description: |
26
- Data attributes can be applied to the summary element of the component.
27
-
28
- This can be used for tracking as shown. Custom JavaScript in the component fires tracking events when the details element is opened and closed. By default, `track-label` is set to the status (`open` or `closed`) unless a `track_label` is passed into the component.
29
- data:
30
- title: Help with nationality
31
- data_attributes:
32
- track_category: "checker-qa"
33
- track_action: "business-question"
34
- track_label: "custom label here"
35
- track_options:
36
- dimension20: "custom dimension"
37
- block: |
38
- We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.
39
24
  with_aria_attributes:
40
25
  description: |
41
26
  Aria attributes can be applied to the summary element of the component.
@@ -75,19 +75,17 @@ examples:
75
75
  public_updated_at: 2016-09-05 16:48:27
76
76
  document_type: 'Statutory guidance'
77
77
  with_data_attributes_on_links:
78
- description: Note that the component does not include built in Universal Analytics 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).
79
78
  data:
80
79
  items:
81
80
  - link:
82
81
  text: 'School behaviour and attendance: parental responsibility measures'
83
82
  path: '/government/publications/parental-responsibility-measures-for-behaviour-and-attendance'
84
83
  data_attributes:
85
- track_category: 'navDocumentCollectionLinkClicked'
86
- track_action: 1.1
87
- track_label: '/government/publications/parental-responsibility-measures-for-behaviour-and-attendance'
88
- track_options:
89
- dimension28: 2
90
- dimension29: 'School behaviour and attendance: parental responsibility measures'
84
+ a_thing: 'hello'
85
+ another_thing: 'there'
86
+ more_things:
87
+ look: 'over'
88
+ there: 'now'
91
89
  metadata:
92
90
  public_updated_at: 2017-01-05 14:50:33
93
91
  document_type: 'Statutory guidance'
@@ -95,12 +93,11 @@ examples:
95
93
  text: 'School exclusion'
96
94
  path: '/government/publications/school-exclusion'
97
95
  data_attributes:
98
- track_category: 'navDocumentCollectionLinkClicked'
99
- track_action: 1.2
100
- track_label: '/government/publications/school-exclusion'
101
- track_options:
102
- dimension28: 2
103
- dimension29: 'School exclusion'
96
+ a_thing: 'hello'
97
+ another_thing: 'there'
98
+ more_things:
99
+ look: 'over'
100
+ there: 'now'
104
101
  metadata:
105
102
  public_updated_at: 2017-07-19 15:01:48
106
103
  document_type: 'Statutory guidance'
@@ -306,11 +303,7 @@ examples:
306
303
  path: '/universal-credit/eligibility'
307
304
  description: 'You may be able to get Universal Credit if: you’re on a low income or out...'
308
305
  data_attributes:
309
- track_category: 'resultPart'
310
- track_action: 2
311
- track_label: 'Result part 2'
312
- track_options:
313
- dimension82: 2
306
+ an_attribute: some_value
314
307
  - link:
315
308
  text: 'Criteria'
316
309
  description: 'no url provided, just text'
@@ -25,7 +25,7 @@ examples:
25
25
  description: |
26
26
  The example shown applies a tracking attribute specifically for use by Google Tag Manager in [Content Publisher](https://github.com/alphagov/content-publisher).
27
27
 
28
- 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).
28
+ 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).
29
29
  data:
30
30
  message: Message to alert the user to a unsuccessful action goes here
31
31
  description: A further description
@@ -504,17 +504,6 @@ examples:
504
504
  block: |
505
505
  <p>This content has a YouTube livestream link, converted to an accessible embedded player by component JavaScript.</p>
506
506
  <p><a href="https://www.youtube.com/embed/live_stream?channel=UCoMdktPbSTixAyNGwb-UYkQ">Livestream video</a></p>
507
- with_youtube_analytics:
508
- data:
509
- block: |
510
- <p>This content has a YouTube link with analytics, converted to an accessible embedded player by component JavaScript.</p>
511
- <p>
512
- <a href="https://www.youtube.com/watch?v=ucjmWjJ25Ho"
513
- data-youtube-player-analytics="true"
514
- data-youtube-player-analytics-category="demo-for-components">
515
- Youtube video with tracking
516
- </a>
517
- </p>
518
507
  with_youtube_embed_disabled:
519
508
  data:
520
509
  disable_youtube_expansions: true
@@ -246,37 +246,6 @@ examples:
246
246
  <div class="govuk-!-width-full">
247
247
  <%= component %>
248
248
  </div>
249
- with_data_attributes:
250
- 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).
251
- data:
252
- href: "/i-am-not-a-valid-link"
253
- href_data_attributes: {
254
- track_category: 'href_category',
255
- track_action: 1.1,
256
- track_label: 'href_label',
257
- track_options: {
258
- dimension28: 1,
259
- dimension29: 'dimension29Href'
260
- }
261
- }
262
- image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
263
- image_alt: "some meaningful alt text please"
264
- heading_text: "A link with tracking"
265
- extra_details: [
266
- {
267
- text: "Another link with tracking",
268
- href: "/1",
269
- data_attributes: {
270
- track_category: 'extra_category',
271
- track_action: 2.1,
272
- track_label: 'extra_label',
273
- track_options: {
274
- dimension28: 1,
275
- dimension29: 'dimension29Extra'
276
- }
277
- }
278
- }
279
- ]
280
249
  with_ga4_tracking:
281
250
  description: The component does not include an option for GA4 tracking, but data attributes to enable the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) can be passed as shown.
282
251
  data:
@@ -63,32 +63,6 @@ examples:
63
63
  suggestion_link_url: www.google.com/permit
64
64
  new_tab: true
65
65
 
66
- with_data_attributes:
67
- description: |
68
- This example shows the use of `suggestion_data_attributes`,
69
- `dismiss_data_attributes` for click tracking on the dismiss section <p> tag, and `dismiss_link_data_attributes` for adding attributes to the dismiss link <a> tag.
70
-
71
- 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).
72
- data:
73
- suggestion_text: Based on your browsing you might be interested in
74
- suggestion_link_text: "Travel abroad: step by step"
75
- suggestion_link_url: /travel-abroad
76
- suggestion_data_attributes:
77
- track-category: interventionBanner
78
- track-action: interventionClicked
79
- track-dimension: "Travel abroad: step by step"
80
- track-dimension-index: 29
81
- track-label: clicked suggestion
82
- dismiss_text: Hide this suggestion
83
- name: another-campaign-name
84
- dismiss_data_attributes:
85
- track-category: interventionBanner
86
- track-action: interventionDismissed
87
- track-dimension: Hide this suggestion
88
- track-dimension-index: 29
89
- track-label: hide the intervention
90
- dismiss_link_data_attributes:
91
- track-category: example
92
66
  without_ga4_tracking:
93
67
  description: |
94
68
  Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the component itself, event tracking on the 'Hide' link, and allows pageviews to record the presence of the banner on page load.
@@ -115,11 +115,11 @@ examples:
115
115
  yes:
116
116
  text: Yes
117
117
  data_attributes:
118
- track_category: cookieBanner
118
+ an_attribute: some_value1
119
119
  no:
120
120
  text: No
121
121
  data_attributes:
122
- track-category: cookieBanner
122
+ an_attribute: some_value2
123
123
  cookie_preferences:
124
124
  text: How GOV.UK accounts use cookies
125
125
  href: https://www.gov.uk/government/publications/govuk-accounts-trial-full-privacy-notice-and-accessibility-statement
@@ -5,8 +5,6 @@ body: |
5
5
  the correct analytics identifier metadata tags.
6
6
 
7
7
  These are additionally used by the <a href="https://github.com/alphagov/govuk-browser-extension">GOV.UK browser extension</a> to provide details about a given page.
8
-
9
- The code which reads the meta tags can be found <a href="https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js">in custom-dimensions.js</a>.
10
8
  accessibility_criteria: |
11
9
  The analytics meta tags component should not be visible to any users.
12
10
  display_html: true
@@ -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: