govuk_publishing_components 35.21.3 → 35.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-video-tracker.js +9 -5
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +0 -1
  4. data/app/views/govuk_publishing_components/components/_accordion.html.erb +4 -4
  5. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +10 -10
  6. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +4 -4
  7. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +2 -2
  8. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +6 -6
  9. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +5 -5
  10. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -2
  11. data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +2 -4
  12. data/app/views/govuk_publishing_components/components/_intervention.html.erb +6 -6
  13. data/app/views/govuk_publishing_components/components/_metadata.html.erb +4 -4
  14. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +2 -2
  15. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +4 -4
  16. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -3
  17. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +5 -5
  18. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +4 -4
  19. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +4 -4
  20. data/app/views/govuk_publishing_components/components/_tabs.html.erb +9 -9
  21. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +2 -2
  22. data/app/views/govuk_publishing_components/components/docs/accordion.yml +4 -4
  23. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +3 -3
  24. data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +3 -4
  25. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +3 -3
  26. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +9 -9
  27. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +3 -3
  28. data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +4 -4
  29. data/app/views/govuk_publishing_components/components/docs/emergency_banner.yml +3 -3
  30. data/app/views/govuk_publishing_components/components/docs/intervention.yml +8 -8
  31. data/app/views/govuk_publishing_components/components/docs/metadata.yml +7 -3
  32. data/app/views/govuk_publishing_components/components/docs/phase_banner.yml +3 -3
  33. data/app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml +3 -3
  34. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +3 -4
  35. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +7 -11
  36. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +3 -3
  37. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +4 -4
  38. data/app/views/govuk_publishing_components/components/docs/tabs.yml +5 -5
  39. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +3 -3
  40. data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +3 -3
  41. data/lib/govuk_publishing_components/version.rb +1 -1
  42. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c928d56fbe68a0a4819b63b6057a80667c24713ecc0bc79dbeaa5980f036125
4
- data.tar.gz: e17a211723d9d0100e69120d84dc293980677bae6bf39b0d3cf4901edbcf0b69
3
+ metadata.gz: b44a8215911c2a260e0b80134c14d3f974a4ee0bb91cdf7eb23dc081e61ee9d9
4
+ data.tar.gz: 4262f87d3ce863db103a0f24e3936b69e2219b0794ad83d142abb115bf7fe66a
5
5
  SHA512:
6
- metadata.gz: c2004ec2b34d6559eae86c18224a7f58f6d1e55c80842d6ced8a285f6c5e8db83d2fe1dc1cb87f00b7db8d673a24b5922d2b2afe0f916ad448a36566cd1ec2d2
7
- data.tar.gz: 7c1262f1545a1fca6b0c14c5fe7ac2b681f6b506028dfa065319d0ec7902955d820e8ff1261a5f172b8dfcbcf066c4cf18c6263f3f5bc029252efe8881675527
6
+ metadata.gz: 4deebaa45c7bb16f6acbbc0ae2b916222a6e8b3c9efb05581f3fefbf8e4b87b3ee772025b81399055e3bbedceb6162d1cd9df56b7e22f6ad1f6637523dea307c
7
+ data.tar.gz: 1fef3fd8a3ab99df0359cfd7d2787ba7d0d62ee50e12e455acb64fad1c51fbb47bc657b4f3ef784767c9c2fb95967678be14d168efb9db789ce28b618118e2bc
@@ -13,7 +13,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
13
13
  configureVideo: function (event) {
14
14
  var player = event.target
15
15
  var videoId = player.id
16
- var duration = player.getDuration()
16
+ var duration = Math.ceil(player.getDuration())
17
17
  var percentages = [25, 50, 75]
18
18
 
19
19
  for (var i = 0; i < percentages.length; i++) {
@@ -23,6 +23,10 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
23
23
  // interval is once a second, so end point must be at least one second beyond begin point
24
24
  this.handlers['video-' + videoId + '-' + percent + '-percent-end'] = position + 2
25
25
  }
26
+ // store all these values otherwise we have to get them for every event
27
+ this.handlers['video-' + videoId + '-duration'] = duration // store initially, as number returned from API varies
28
+ this.handlers['video-' + videoId + '-title'] = player.videoTitle
29
+ this.handlers['video-' + videoId + '-url'] = this.cleanVideoUrl(player.getVideoUrl())
26
30
  },
27
31
 
28
32
  trackVideo: function (event, state) {
@@ -68,13 +72,13 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
68
72
 
69
73
  sendData: function (player, event, position) {
70
74
  var data = {}
75
+ data.action = event
71
76
  data.event_name = 'video_' + event
72
77
  data.type = 'video'
73
- data.url = this.cleanVideoUrl(player.getVideoUrl())
74
- data.text = player.videoTitle
75
- data.action = event
78
+ data.url = this.handlers['video-' + player.id + '-url']
79
+ data.text = this.handlers['video-' + player.id + '-title']
76
80
  data.video_current_time = Math.round(player.getCurrentTime())
77
- data.video_duration = Math.ceil(player.getDuration()) // number returned from the API varies, so round up
81
+ data.video_duration = this.handlers['video-' + player.id + '-duration']
78
82
  data.video_percent = position
79
83
 
80
84
  var schemas = new window.GOVUK.analyticsGa4.Schemas()
@@ -23,7 +23,6 @@
23
23
  }
24
24
 
25
25
  .gem-c-metadata--inverse {
26
- background-color: govuk-colour("blue");
27
26
  color: govuk-colour("white");
28
27
 
29
28
  a {
@@ -10,7 +10,7 @@
10
10
  anchor_navigation ||= false
11
11
  track_show_all_clicks ||= false
12
12
  track_sections ||= false
13
- ga4_tracking ||= false
13
+ disable_ga4 ||= false
14
14
  data_attributes_show_all ||= nil
15
15
 
16
16
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
@@ -19,8 +19,8 @@
19
19
  component_helper.add_class(shared_helper.get_margin_bottom)
20
20
 
21
21
  component_helper.add_data_attribute({ module: "govuk-accordion gem-accordion" })
22
- component_helper.add_data_attribute({ module: "ga4-event-tracker" }) if ga4_tracking
23
- component_helper.add_data_attribute({ ga4_expandable: "" }) if ga4_tracking
22
+ component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4
23
+ component_helper.add_data_attribute({ ga4_expandable: "" }) unless disable_ga4
24
24
  component_helper.add_data_attribute({ anchor_navigation: anchor_navigation }) if anchor_navigation
25
25
  component_helper.add_data_attribute({ track_show_all_clicks: track_show_all_clicks }) if track_show_all_clicks
26
26
  component_helper.add_data_attribute({ track_sections: track_sections }) if track_sections
@@ -39,7 +39,7 @@
39
39
  item[:data_attributes] ||= nil
40
40
  ga4_link_data_attributes ||= nil
41
41
 
42
- if ga4_tracking
42
+ unless disable_ga4
43
43
  heading_text = Nokogiri::HTML(item[:heading][:text]).text
44
44
  item[:data_attributes] ||= {}
45
45
  item[:data_attributes][:ga4_event] = {
@@ -12,18 +12,18 @@
12
12
  link_classes << brand_helper.color_class
13
13
  link_classes << "govuk-link--no-underline" unless underline_links
14
14
 
15
- ga4_tracking ||= false
15
+ disable_ga4 ||= false
16
16
  ga4_data = {
17
17
  event_name: "navigation",
18
18
  section: t("components.contents_list.contents", locale: :en) || "",
19
19
  type: "contents list",
20
20
  index_total: cl_helper.get_index_total,
21
- } if ga4_tracking
21
+ } unless disable_ga4
22
22
  local_assigns[:aria] ||= {}
23
23
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
24
24
  component_helper.add_class("gem-c-contents-list #{brand_helper.brand_class}")
25
25
  component_helper.add_data_attribute({ module: "gem-track-click" })
26
- component_helper.add_data_attribute({ module: "ga4-link-tracker" }) if ga4_tracking
26
+ component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
27
27
  component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
28
28
  component_helper.add_role("navigation")
29
29
  -%>
@@ -38,11 +38,11 @@
38
38
  <% end %>
39
39
 
40
40
  <ol class="gem-c-contents-list__list">
41
- <% index_link = 1 if ga4_tracking %>
41
+ <% index_link = 1 unless disable_ga4 %>
42
42
  <% contents.each.with_index(1) do |contents_item, position| %>
43
43
  <li class="<%= cl_helper.list_item_classes(contents_item, false) %>" <%= "aria-current=true" if contents_item[:active] %>>
44
44
  <% link_text = format_numbers ? cl_helper.wrap_numbers_with_spans(contents_item[:text]) : contents_item[:text]
45
- if ga4_tracking
45
+ unless disable_ga4
46
46
  ga4_data[:event_name] = cl_helper.get_ga4_event_name(contents_item[:href]) if contents_item[:href]
47
47
  ga4_data[:index_link] = index_link
48
48
  end
@@ -56,16 +56,16 @@
56
56
  track_options: {
57
57
  dimension29: contents_item[:text]
58
58
  },
59
- ga4_link: (ga4_tracking ? ga4_data.to_json : nil)
59
+ ga4_link: (!disable_ga4 ? ga4_data.to_json : nil)
60
60
  }
61
61
  %>
62
- <% index_link += 1 if ga4_tracking %>
62
+ <% index_link += 1 unless disable_ga4 %>
63
63
  <% if contents_item[:items] && contents_item[:items].any? %>
64
64
  <ol class="gem-c-contents-list__nested-list">
65
65
  <% contents_item[:items].each.with_index(1) do |nested_contents_item, nested_position| %>
66
66
  <li class="<%= cl_helper.list_item_classes(nested_contents_item, true) %>" <%= "aria-current=true" if nested_contents_item[:active] %>>
67
67
  <%
68
- if ga4_tracking
68
+ unless disable_ga4
69
69
  ga4_data[:event_name] = cl_helper.get_ga4_event_name(nested_contents_item[:href]) if nested_contents_item[:href]
70
70
  ga4_data[:index_link] = index_link
71
71
  end
@@ -79,11 +79,11 @@
79
79
  track_options: {
80
80
  dimension29: nested_contents_item[:text]
81
81
  },
82
- ga4_link: (ga4_tracking ? ga4_data.to_json : nil)
82
+ ga4_link: (!disable_ga4 ? ga4_data.to_json : nil)
83
83
  }
84
84
  %>
85
85
  </li>
86
- <% index_link += 1 if ga4_tracking %>
86
+ <% index_link += 1 unless disable_ga4 %>
87
87
  <% end %>
88
88
  </ol>
89
89
  <% end %>
@@ -1,9 +1,9 @@
1
- <%
2
- ga4_tracking ||= false
1
+ <%
2
+ disable_ga4 ||= false
3
3
  prioritise_taxon_breadcrumbs ||= false
4
- breadcrumb_selector = GovukPublishingComponents::Presenters::BreadcrumbSelector.new(content_item, request, prioritise_taxon_breadcrumbs, ga4_tracking)
4
+ breadcrumb_selector = GovukPublishingComponents::Presenters::BreadcrumbSelector.new(content_item, request, prioritise_taxon_breadcrumbs, disable_ga4)
5
5
  inverse ||= false
6
- collapse_on_mobile ||= true unless local_assigns[:collapse_on_mobile].eql?(false)
6
+ collapse_on_mobile ||= true unless local_assigns[:collapse_on_mobile].eql?(false)
7
7
  %>
8
8
 
9
9
  <div class="gem-c-contextual-breadcrumbs">
@@ -1,12 +1,12 @@
1
1
  <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
- <% ga4_tracking ||= false %>
2
+ <% disable_ga4 ||= false %>
3
3
 
4
4
  <% unless navigation.content_tagged_to_current_step_by_step? %>
5
5
  <div class="gem-c-contextual-footer">
6
6
  <%# Rendering related navigation because no step by step list %>
7
7
  <%= render 'govuk_publishing_components/components/related_navigation',
8
8
  content_item: content_item,
9
- ga4_tracking: ga4_tracking,
9
+ disable_ga4: disable_ga4,
10
10
  context: :footer %>
11
11
  </div>
12
12
  <% end %>
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("contextual-sidebar")
3
3
 
4
- ga4_tracking ||= false
5
- request.query_parameters[:ga4_tracking] = ga4_tracking
4
+ disable_ga4 ||= false
5
+ request.query_parameters[:disable_ga4] = disable_ga4
6
6
  navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request)
7
7
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
8
8
  show_ukraine_cta = navigation.show_ukraine_cta?
@@ -13,7 +13,7 @@
13
13
  <div class="gem-c-contextual-sidebar">
14
14
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
15
15
  <%# Rendering step by step related items because there are a few but not too many of them %>
16
- <%= render 'govuk_publishing_components/components/step_by_step_nav_related', links: navigation.step_nav_helper.related_links, ga4_tracking: ga4_tracking %>
16
+ <%= render 'govuk_publishing_components/components/step_by_step_nav_related', links: navigation.step_nav_helper.related_links, disable_ga4: disable_ga4 %>
17
17
  <% end %>
18
18
 
19
19
  <% if navigation.content_tagged_to_current_step_by_step? %>
@@ -21,7 +21,7 @@
21
21
  <%= render 'govuk_publishing_components/components/step_by_step_nav', navigation.step_nav_helper.sidebar %>
22
22
  <% else %>
23
23
  <%# Rendering related navigation sidebar because no step by step list %>
24
- <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar, ga4_tracking: ga4_tracking, ga4_tracking_counts: ga4_tracking_counts %>
24
+ <%= render 'govuk_publishing_components/components/related_navigation', content_item: content_item, context: :sidebar, disable_ga4: disable_ga4, ga4_tracking_counts: ga4_tracking_counts %>
25
25
  <% end %>
26
26
 
27
27
  <% if navigation.content_tagged_to_other_step_by_steps? %>
@@ -30,11 +30,11 @@
30
30
  pretitle: t("components.contextual_sidebar.pretitle"),
31
31
  links: navigation.step_nav_helper.also_part_of_step_nav,
32
32
  always_display_as_list: true,
33
- ga4_tracking: ga4_tracking
33
+ disable_ga4: disable_ga4
34
34
  } %>
35
35
  <% end %>
36
36
 
37
37
  <% if show_ukraine_cta %>
38
- <%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item, ga4_tracking: ga4_tracking, ga4_tracking_counts: ga4_tracking_counts %>
38
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item, disable_ga4: disable_ga4, ga4_tracking_counts: ga4_tracking_counts %>
39
39
  <% end %>
40
40
  </div>
@@ -31,7 +31,7 @@
31
31
  css_classes = %w(gem-c-cookie-banner govuk-clearfix govuk-cookie-banner js-banner-wrapper)
32
32
  css_classes << "gem-c-cookie-banner--services" if services_cookies
33
33
 
34
- ga4_tracking ||= false
34
+ disable_ga4 ||= false
35
35
  %>
36
36
 
37
37
  <div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" data-nosnippet role="region" aria-label="<%= title %>">
@@ -42,7 +42,7 @@
42
42
  <div tabindex="-1" class="govuk-cookie-banner__content gem-c-cookie-banner__confirmation">
43
43
  <span class="gem-c-cookie-banner__content"><%= text %></span>
44
44
  <p class="gem-c-cookie-banner__confirmation-message--accepted govuk-body" hidden
45
- <% if ga4_tracking %>
45
+ <% unless disable_ga4 %>
46
46
  data-ga4-cookie-banner <%# GA4 pageview JS looks for data-ga4-cookie-banner %>
47
47
  data-module="ga4-link-tracker"
48
48
  data-ga4-track-links-only
@@ -96,14 +96,14 @@
96
96
  <div hidden class="js-hide-button govuk-button-group">
97
97
  <%
98
98
  button_data_module = "gem-track-click"
99
- button_data_module << " ga4-event-tracker" if ga4_tracking
99
+ button_data_module << " ga4-event-tracker" unless disable_ga4
100
100
 
101
101
  ga4_event = {
102
102
  event_name: "select_content",
103
103
  type: "cookie banner",
104
104
  action: "closed",
105
105
  section: t("components.cookie_banner.confirmation_message.accepted", locale: :en)
106
- }.to_json if ga4_tracking
106
+ }.to_json unless disable_ga4
107
107
  %>
108
108
  <button
109
109
  class="gem-c-cookie-banner__hide-button govuk-button"
@@ -111,7 +111,7 @@
111
111
  data-module="<%= button_data_module %>"
112
112
  data-track-category="cookieBanner"
113
113
  data-track-action="Hide cookie banner"
114
- <% if ga4_tracking %> data-ga4-event="<%= ga4_event %>" <% end %>>
114
+ <% unless disable_ga4 %> data-ga4-event="<%= ga4_event %>" <% end %>>
115
115
  <%= t("components.cookie_banner.hide") %>
116
116
  </button>
117
117
  </div>
@@ -6,10 +6,10 @@
6
6
 
7
7
  applies_to ||= t("components.devolved_nations.applies_to")
8
8
  heading_level ||= 2
9
- ga4_tracking ||= false
9
+ disable_ga4 ||= false
10
10
  data_attributes = {}
11
11
 
12
- if ga4_tracking
12
+ unless disable_ga4
13
13
  data_attributes[:ga4_devolved_nations_banner] = devolved_nations_helper.ga4_applicable_nations_title_text(true)
14
14
  data_attributes[:module] = "ga4-link-tracker"
15
15
  data_attributes[:ga4_track_links_only] = ""
@@ -7,7 +7,7 @@
7
7
  link_text ||= "More information"
8
8
  campaign_class ||= nil
9
9
  homepage ||= false
10
- ga4_tracking ||= false
10
+ disable_ga4 ||= false
11
11
 
12
12
  emergency_banner_helper = GovukPublishingComponents::Presenters::EmergencyBannerHelper.new()
13
13
 
@@ -29,12 +29,11 @@
29
29
  description_classes = %w[gem-c-emergency-banner__description]
30
30
  description_classes << "gem-c-emergency-banner__description--homepage" if homepage
31
31
 
32
-
33
32
  data_attributes = {
34
33
  "nosnippet": true,
35
34
  }
36
35
 
37
- if ga4_tracking
36
+ unless disable_ga4
38
37
  data_attributes[:ga4_emergency_banner] = ""
39
38
  data_attributes[:module] = "ga4-link-tracker"
40
39
  data_attributes[:ga4_track_links_only] = ""
@@ -46,7 +45,6 @@
46
45
  }.to_json
47
46
  end
48
47
  %>
49
-
50
48
  <%= content_tag('section', class: banner_classes, "aria-labelledby": "emergency-banner-heading", data: data_attributes) do %>
51
49
  <div class="govuk-width-container">
52
50
  <div class="govuk-grid-row">
@@ -32,10 +32,10 @@
32
32
  intervention_helper = GovukPublishingComponents::Presenters::InterventionHelper.new(options)
33
33
  dismiss_href = intervention_helper.dismiss_link
34
34
 
35
- ga4_tracking ||= false
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_link: 1, index_total: 1 }.to_json if ga4_tracking
38
- data_attributes[:ga4_intervention_banner] = "" if ga4_tracking # Added to the parent element for the GA4 pageview object to use
35
+ disable_ga4 ||= false
36
+ suggestion_data_attributes[:module] = "#{suggestion_data_attributes[:module]} ga4-link-tracker".strip unless disable_ga4
37
+ suggestion_data_attributes[:ga4_link] = { event_name: "navigation", type: "intervention", section: suggestion_text, index_link: 1, index_total: 1 }.to_json unless disable_ga4
38
+ data_attributes[:ga4_intervention_banner] = "" unless disable_ga4 # Added to the parent element for the GA4 pageview object to use
39
39
 
40
40
  suggestion_tag_options = {
41
41
  class: "govuk-link",
@@ -59,8 +59,8 @@
59
59
  }
60
60
  section_options.merge!({ hidden: true }) if hide
61
61
 
62
- dismiss_link_data_attributes[:module] = "#{dismiss_link_data_attributes[:module]} ga4-event-tracker".strip if ga4_tracking
63
- dismiss_link_data_attributes[:ga4_event] = { event_name: "select_content", type: "intervention", section: suggestion_text, action: 'closed' }.to_json if ga4_tracking
62
+ dismiss_link_data_attributes[:module] = "#{dismiss_link_data_attributes[:module]} ga4-event-tracker".strip unless disable_ga4
63
+ dismiss_link_data_attributes[:ga4_event] = { event_name: "select_content", type: "intervention", section: suggestion_text, action: 'closed' }.to_json unless disable_ga4
64
64
  %>
65
65
  <% if intervention_helper.show? %>
66
66
  <%= tag.section **section_options do %>
@@ -26,13 +26,13 @@
26
26
 
27
27
  classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
28
28
 
29
- ga4_tracking ||= false
29
+ disable_ga4 ||= false
30
30
  ga4_object = {
31
31
  event_name: "navigation",
32
32
  type: "content history",
33
33
  section: "Top",
34
34
  action: "opened"
35
- }.to_json
35
+ }.to_json unless disable_ga4
36
36
  %>
37
37
  <%= content_tag :div, class: classes, data: { module: "gem-toggle metadata" } do %>
38
38
  <dl class="gem-c-metadata__list" data-module="gem-track-click">
@@ -66,7 +66,7 @@
66
66
  data-track-category="content-history"
67
67
  data-track-action="see-all-updates-link-clicked"
68
68
  data-track-label="history"
69
- <% if ga4_tracking %>
69
+ <% unless disable_ga4 %>
70
70
  data-module="ga4-link-tracker"
71
71
  data-ga4-link="<%= ga4_object %>"
72
72
  <% end%>>
@@ -84,7 +84,7 @@
84
84
  <% if definition.any? %>
85
85
  <dt class="gem-c-metadata__term"><%= title %>:</dt>
86
86
  <dd class="gem-c-metadata__definition"
87
- <% if ga4_tracking %>
87
+ <% unless disable_ga4 %>
88
88
  data-module="ga4-link-tracker"
89
89
  data-ga4-track-links-only
90
90
  data-ga4-link="<%= ga4_object %>"
@@ -5,7 +5,7 @@ app_name ||= nil
5
5
  phase ||= nil
6
6
  message ||= nil
7
7
  inverse ||= false
8
- ga4_tracking ||= false
8
+ disable_ga4 ||= false
9
9
 
10
10
  unless message.present?
11
11
  if phase == "beta"
@@ -20,7 +20,7 @@ container_css_classes << "gem-c-phase-banner--inverse" if inverse
20
20
 
21
21
  data_attributes = {}
22
22
 
23
- if ga4_tracking
23
+ unless disable_ga4
24
24
  data_attributes[:ga4_phase_banner] = phase
25
25
  data_attributes[:module] = "ga4-link-tracker"
26
26
  data_attributes[:ga4_track_links_only] = ""
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("previous-and-next-navigation")
3
- ga4_tracking ||= false
3
+ disable_ga4 ||= false
4
4
 
5
5
  if local_assigns.include?(:next_page) || local_assigns.include?(:previous_page)
6
6
  %>
@@ -8,7 +8,7 @@
8
8
  class="govuk-pagination govuk-pagination--block"
9
9
  role="navigation"
10
10
  aria-label="<%= t("components.previous_and_next_navigation.pagination") %>"
11
- <% if ga4_tracking %>
11
+ <% unless disable_ga4 %>
12
12
  data-module="ga4-link-tracker"
13
13
  <% end %>
14
14
  >
@@ -27,7 +27,7 @@
27
27
  data-track-label="<%= previous_page[:url] %>"
28
28
  data-track-dimension="previous"
29
29
  data-track-dimension-index="29"
30
- <% if ga4_tracking %>
30
+ <% unless disable_ga4 %>
31
31
  data-ga4-link = "<%= {
32
32
  event_name: "navigation",
33
33
  type: "previous and next",
@@ -63,7 +63,7 @@
63
63
  data-track-label="<%= next_page[:url] %>"
64
64
  data-track-dimension="next"
65
65
  data-track-dimension-index="29"
66
- <% if ga4_tracking %>
66
+ <% unless disable_ga4 %>
67
67
  data-ga4-link = "<%= {
68
68
  event_name: "navigation",
69
69
  type: "previous and next",
@@ -1,11 +1,11 @@
1
1
  <%
2
2
  related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns)
3
3
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
- ga4_tracking ||= false
4
+ disable_ga4 ||= false
5
5
  ga4_type = local_assigns[:context] == :footer ? "contextual footer" : "related content"
6
6
  data = {}
7
7
  data[:module] = "gem-track-click"
8
- data[:module] << " ga4-link-tracker" if ga4_tracking
8
+ data[:module] << " ga4-link-tracker" unless disable_ga4
9
9
  ga4_tracking_counts ||= OpenStruct.new(index_section_count: 0)
10
10
  ga4_tracking_counts.index_section_count += related_nav_helper.index_section_count
11
11
 
@@ -43,7 +43,7 @@
43
43
  section_index: section_index,
44
44
  section_count: ga4_tracking_counts.index_section_count,
45
45
  random: random,
46
- ga4_tracking: ga4_tracking,
46
+ disable_ga4: disable_ga4,
47
47
  ga4_type: ga4_type %>
48
48
  <% end %>
49
49
  <% end %>
@@ -18,12 +18,12 @@
18
18
 
19
19
  step_nav_helper = GovukPublishingComponents::Presenters::StepByStepNavHelper.new
20
20
 
21
- ga4_tracking ||= false
21
+ disable_ga4 ||= false
22
22
  %>
23
23
  <% if steps %>
24
24
  <div
25
- data-module="gemstepnav<% if ga4_tracking %> ga4-event-tracker<% end %>"
26
- <%= "data-ga4-expandable" if ga4_tracking %>
25
+ data-module="gemstepnav<% unless disable_ga4 %> ga4-event-tracker<% end %>"
26
+ <%= "data-ga4-expandable" unless disable_ga4 %>
27
27
  class="gem-c-step-nav js-hidden <% if small %>govuk-!-display-none-print<% end %> <% unless small %>gem-c-step-nav--large<% end %>"
28
28
  <%= "data-remember" if remember_last_step %>
29
29
  <%= "data-id=#{tracking_id}" if tracking_id %>
@@ -76,7 +76,7 @@
76
76
  <%
77
77
  ga4_link_data = {}
78
78
 
79
- if ga4_tracking
79
+ unless disable_ga4
80
80
  ga4_link_data = {
81
81
  "module": "ga4-link-tracker",
82
82
  "ga4-track-links-only": "",
@@ -99,7 +99,7 @@
99
99
  options[:step_title] = step[:title]
100
100
  options[:step_index] = step_index
101
101
  options[:link_index] = 0
102
- options[:ga4_tracking] = ga4_tracking
102
+ options[:disable_ga4] = disable_ga4
103
103
  %>
104
104
  <% step[:contents].each do |element| %>
105
105
  <%= step_nav_helper.render_step_nav_element(element, options) %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  title ||= false
5
5
  path ||= false
6
- ga4_tracking ||= false
6
+ disable_ga4 ||= false
7
7
  breadcrumbs = [
8
8
  { title: "Home", url: "/" },
9
9
  { title: title, url: path }
@@ -12,7 +12,7 @@
12
12
 
13
13
  data = {}
14
14
  data[:module] = "gem-track-click"
15
- data[:module] << " ga4-link-tracker" if ga4_tracking
15
+ data[:module] << " ga4-link-tracker" unless disable_ga4
16
16
 
17
17
  tracking_id ||= false
18
18
  tracking_category ||= "stepNavHeaderClicked"
@@ -26,7 +26,7 @@
26
26
  tracking_options ||= ({ dimension96: tracking_id }).to_json
27
27
  end
28
28
 
29
- if ga4_tracking
29
+ unless disable_ga4
30
30
  ga4_data = {
31
31
  event_name: "navigation",
32
32
  type: "super breadcrumb",
@@ -52,7 +52,7 @@
52
52
  data-track-category="<%= tracking_category %>"
53
53
  data-track-action="<%= tracking_action %>"
54
54
  data-track-label="<%= tracking_label %>"
55
- <% if ga4_tracking %>
55
+ <% unless disable_ga4 %>
56
56
  data-ga4-link='<%= ga4_data %>'
57
57
  <% end %>
58
58
  <% if tracking_dimension_enabled %>
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("step-by-step-nav-related")
3
- ga4_tracking ||= false
3
+ disable_ga4 ||= false
4
4
  links ||= []
5
5
  pretitle ||= t("components.step_by_step_nav_related.part_of")
6
6
  always_display_as_list ||= false
@@ -8,7 +8,7 @@
8
8
  classes << "gem-c-step-nav-related--singular" if links.length == 1
9
9
  data = {}
10
10
  data[:module] = "gem-track-click"
11
- data[:module] << " ga4-link-tracker" if ga4_tracking
11
+ data[:module] << " ga4-link-tracker" unless disable_ga4
12
12
  %>
13
13
  <% if links.any? %>
14
14
  <%= tag.div(class: classes, data: data) do %>
@@ -23,7 +23,7 @@
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
+ <% unless disable_ga4
27
27
  ga4_attributes = {
28
28
  event_name: "navigation",
29
29
  type: "part of",
@@ -51,7 +51,7 @@
51
51
  data-track-dimension="<%= link[:text] %>"
52
52
  data-track-dimension-index="29"
53
53
  data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'
54
- <% if ga4_tracking
54
+ <% unless disable_ga4
55
55
  ga4_attributes = {
56
56
  event_name: "navigation",
57
57
  type: "part of",
@@ -8,13 +8,13 @@
8
8
  panel_css_classes = panel_css_classes.join(" ")
9
9
 
10
10
  as_links ||= false
11
- ga4_tracking ||= false
11
+ disable_ga4 ||= false
12
12
 
13
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
14
  component_helper.add_class("govuk-tabs gem-c-tabs")
15
15
  component_helper.add_data_attribute({ module: "govuk-tabs" }) unless as_links
16
16
 
17
- if ga4_tracking
17
+ unless disable_ga4
18
18
  component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless as_links
19
19
  component_helper.add_data_attribute({ module: "ga4-link-tracker" }) if as_links
20
20
  end
@@ -29,7 +29,7 @@
29
29
  <li class="govuk-tabs__list-item <%= "govuk-tabs__list-item--selected" if tab[:active] %>">
30
30
  <%
31
31
  tab[:tab_data_attributes] ||= {}
32
- if ga4_tracking
32
+ unless disable_ga4
33
33
  ga4_attributes = {
34
34
  event_name: "select_content",
35
35
  type: "tabs",
@@ -65,10 +65,10 @@
65
65
  <% end %>
66
66
  <% end %>
67
67
  <% if tabs.count == 1 %>
68
- <section id="<%= tabs[0][:id] %>">
69
- <% if tabs[0][:title] %>
70
- <h2 class="govuk-heading-l"><%= tabs[0][:title] %></h2>
71
- <% end %>
72
- <%= tabs[0][:content] %>
73
- </section>
68
+ <section id="<%= tabs[0][:id] %>">
69
+ <% if tabs[0][:title] %>
70
+ <h2 class="govuk-heading-l"><%= tabs[0][:title] %></h2>
71
+ <% end %>
72
+ <%= tabs[0][:content] %>
73
+ </section>
74
74
  <% end %>
@@ -3,7 +3,7 @@
3
3
  title = t("components.related_navigation.ukraine.title")
4
4
  lang = shared_helper.t_locale("components.related_navigation.ukraine.title")
5
5
  data_module = "gem-track-click"
6
- data_module << " ga4-link-tracker" if ga4_tracking
6
+ data_module << " ga4-link-tracker" unless disable_ga4
7
7
  %>
8
8
  <%= tag.div class: "gem-c-contextual-sidebar__cta gem-c-contextual-sidebar__cta--ukraine", data: { module: data_module } do %>
9
9
  <%= tag.h2 title, class: "gem-c-contextual-sidebar__heading govuk-heading-s" %>
@@ -20,7 +20,7 @@
20
20
  index_section_count: "#{ga4_tracking_counts.index_section_count}",
21
21
  index_total: "#{index_total}",
22
22
  section: title,
23
- } if ga4_tracking
23
+ } unless disable_ga4
24
24
  %>
25
25
  <%= link_to link[:label],
26
26
  link[:href],
@@ -34,7 +34,7 @@ accessibility_criteria: |
34
34
 
35
35
  * be fully expanded
36
36
  * not be marked as expandable
37
- uses_component_wrapper_helper: true
37
+ uses_component_wrapper_helper: true
38
38
  shared_accessibility_criteria:
39
39
  - link
40
40
  examples:
@@ -182,11 +182,11 @@ examples:
182
182
  <a class="govuk-link" href="#">Retiring your service</a>
183
183
  </li>
184
184
  </ul>'
185
- with_ga4_tracking:
185
+ without_ga4_tracking:
186
186
  description: |
187
- Allows you to add GA4 tracking to an accordion. This will add a data module and data-attributes with JSONs to the accordion. See the [ga4-event-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) for more information.
187
+ Disables GA4 tracking on the accordion. Tracking is enabled by default. This adds a data module and data-attributes with JSONs to the accordion. See the [ga4-event-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) for more information.
188
188
  data:
189
- ga4_tracking: true
189
+ disable_ga4: true
190
190
  items:
191
191
  - heading:
192
192
  text: Writing well for the web
@@ -192,10 +192,10 @@ examples:
192
192
  text: 2. Numbers not parsed
193
193
  - href: "#third-thing"
194
194
  text: 3. Numbers are just text
195
- with_ga4_tracking:
196
- description: Enables the GA4 link tracker on the list.
195
+ without_ga4_tracking:
196
+ description: Disables GA4 link tracking on the list. Tracking is enabled by default.
197
197
  data:
198
- ga4_tracking: true
198
+ disable_ga4: true
199
199
  contents:
200
200
  - href: "https://www.gov.uk"
201
201
  text: 1. First thing
@@ -32,13 +32,12 @@ examples:
32
32
  inverse: true
33
33
  context:
34
34
  dark_background: true
35
- with_ga4_tracking:
35
+ without_ga4_tracking:
36
36
  description: |
37
- Adds GA4 tracking to the step by step nav header component when it is rendered as a breadcrumb. See the
37
+ Disables GA4 tracking. Tracking is enabled by default. This includes GA4 tracking on the step by step nav header component when it is rendered as a breadcrumb. See the
38
38
  [ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
39
- Note: tracking on regular breadcrumbs is enabled by default and does not require activating.
40
39
  data:
41
- ga4_tracking: true
40
+ disable_ga4: true
42
41
  content_item:
43
42
  title: "A content item"
44
43
  links:
@@ -69,10 +69,10 @@ examples:
69
69
  ordered_related_items:
70
70
  - title: "Find an apprenticeship"
71
71
  base_path: "/apply-apprenticeship"
72
- with_ga4_tracking:
73
- description: Adds Google Analytics 4 tracking to the Related Navigation component, if it is visible.
72
+ without_ga4_tracking:
73
+ description: Disables GA4 tracking on the component. Tracking is enabled by default.
74
74
  data:
75
- ga4_tracking: true
75
+ disable_ga4: true
76
76
  content_item:
77
77
  title: "A content item"
78
78
  links:
@@ -103,10 +103,10 @@ examples:
103
103
  title: "Russian invasion of Ukraine: UK government response"
104
104
  base_path: "/government/topical-events/russian-invasion-of-ukraine-uk-government-response"
105
105
  locale: "en"
106
- with_ga4_tracking_on_related_navigation:
107
- description: Adds Google Analytics 4 tracking to components within the sidebar. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
106
+ without_ga4_tracking_on_related_navigation:
107
+ description: Disables GA4 tracking on components within the sidebar. Tracking is enabled by default. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA have tracking.
108
108
  data:
109
- ga4_tracking: true
109
+ disable_ga4: true
110
110
  content_item:
111
111
  title: "UK forces arrive to reinforce NATO’s eastern flank"
112
112
  content_id: "a342fd46-d801-4c1e-9d8f-f41fba6da563"
@@ -129,10 +129,10 @@ examples:
129
129
  title: "Russian invasion of Ukraine: UK government response"
130
130
  base_path: "/government/topical-events/russian-invasion-of-ukraine-uk-government-response"
131
131
  locale: "en"
132
- with_ga4_tracking_on_step_by_step:
133
- description: Adds Google Analytics 4 tracking to components within the sidebar. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
132
+ without_ga4_tracking_on_step_by_step:
133
+ description: Disables GA4 tracking on components within the sidebar. Tracking is enabled by default. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
134
134
  data:
135
- ga4_tracking: true
135
+ disable_ga4: true
136
136
  content_item:
137
137
  title: "A content item"
138
138
  links:
@@ -157,10 +157,10 @@ examples:
157
157
  - text: Arrange the funeral
158
158
  href: "/after-a-death/arrange-the-funeral"
159
159
  optional: false
160
- with_ga4_tracking_on_part_of_step_by_step_heading(s):
161
- description: Adds Google Analytics 4 tracking to the "Part of" step by step heading(s) in the sidebar. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
160
+ without_ga4_tracking_on_part_of_step_by_step_heading(s):
161
+ description: Disables GA4 tracking on the "Part of" step by step heading(s) in the sidebar. Tracking is enabled by default. Currently only the Related Navigation component, Step by Step navigation component and Ukraine CTA accept this option.
162
162
  data:
163
- ga4_tracking: true
163
+ disable_ga4: true
164
164
  content_item:
165
165
  links:
166
166
  part_of_step_navs:
@@ -49,8 +49,8 @@ examples:
49
49
  cookie_preferences:
50
50
  text: How we use cookies
51
51
  href: "/cookies"
52
- with_ga4_tracking:
52
+ without_ga4_tracking:
53
53
  description: |
54
- Enables GA4 tracking on the banner. This includes link tracking on the "You have accepted cookies" section, and allows the pageview event that is sent when GA4 initialises to record the presence of the cookie acceptance message.
54
+ Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the "You have accepted cookies" section, and allows the pageview event that is sent when GA4 initialises to record the presence of the cookie acceptance message.
55
55
  data:
56
- ga4_tracking: true
56
+ disable_ga4: true
@@ -19,14 +19,14 @@ examples:
19
19
  national_applicability:
20
20
  england:
21
21
  applicable: true
22
- applies_to_two_nations:
22
+ applies_to_two_nations:
23
23
  data:
24
24
  national_applicability:
25
25
  england:
26
26
  applicable: true
27
27
  wales:
28
28
  applicable: true
29
- applies_to_three_nations:
29
+ applies_to_three_nations:
30
30
  data:
31
31
  national_applicability:
32
32
  england:
@@ -89,9 +89,9 @@ examples:
89
89
  national_applicability:
90
90
  england:
91
91
  applicable: true
92
- with_ga4_tracking:
92
+ without_ga4_tracking:
93
93
  description: |
94
- Enables GA4 tracking on the banner. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
94
+ Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
95
95
  data:
96
96
  national_applicability:
97
97
  england:
@@ -45,13 +45,13 @@ examples:
45
45
  short_description: "1491 to 1547"
46
46
  link: "https://www.gov.uk/"
47
47
  homepage: true
48
- with_ga4_tracking:
48
+ without_ga4_tracking:
49
49
  description: |
50
- Enables GA4 tracking on the banner. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
50
+ Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
51
51
  data:
52
52
  campaign_class: "notable-death"
53
53
  heading: "His Royal Highness Henry VIII"
54
54
  short_description: "1491 to 1547"
55
55
  link: "https://www.gov.uk/"
56
56
  homepage: true
57
- ga4_tracking: true
57
+ disable_ga4: true
@@ -6,9 +6,9 @@ body: |
6
6
  that would be useful to them. This component would be used to add this personalised content and would
7
7
  indicate to the user that this is not normally part of the page, but has been added for them specifically.
8
8
 
9
- The dismiss link works without Javascript by pointing to the current URL with the "hide-intervention"
10
- query string parameter set to "true". It's progressively enhanced and sets a cookie to remember that
11
- the user has dismissed the banner before. The cookie requires a "name" parameter, the value of which
9
+ The dismiss link works without Javascript by pointing to the current URL with the "hide-intervention"
10
+ query string parameter set to "true". It's progressively enhanced and sets a cookie to remember that
11
+ the user has dismissed the banner before. The cookie requires a "name" parameter, the value of which
12
12
  is stored in the cookie to distinguish which campaign banner the user has dismissed.
13
13
 
14
14
  accessibility_criteria: |
@@ -33,8 +33,8 @@ examples:
33
33
  suggestion_link_url: /travel-abroad
34
34
 
35
35
  with_dismiss_link:
36
- description: |
37
- Name is required in order to set a cookie. The name value should be distinct to the campaign for the banner,
36
+ description: |
37
+ Name is required in order to set a cookie. The name value should be distinct to the campaign for the banner,
38
38
  so that other banners using this component are not hidden by accident.
39
39
  data:
40
40
  suggestion_text: You should renew your permit every 6 months.
@@ -89,11 +89,11 @@ examples:
89
89
  track-label: hide the intervention
90
90
  dismiss_link_data_attributes:
91
91
  track-category: example
92
- with_ga4_tracking:
92
+ without_ga4_tracking:
93
93
  description: |
94
- Enables GA4 tracking on the banner. 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.
94
+ 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.
95
95
  data:
96
- ga4_tracking: true
96
+ disable_ga4: true
97
97
  suggestion_text: Based on your browsing you might be interested in
98
98
  suggestion_link_text: "Travel abroad: step by step"
99
99
  suggestion_link_url: /travel-abroad
@@ -355,6 +355,8 @@ examples:
355
355
  see_updates_link: true
356
356
  other:
357
357
  Applies to: England, Scotland, and Wales (see detailed guidance for <a href="http://www.dardni.gov.uk/news-dard-pa022-a-13-new-procedure-for" rel="external">Northern Ireland</a>)
358
+ context:
359
+ dark_background: true
358
360
  on_a_dark_background_without_padding:
359
361
  description: By default the inverse option includes extra spacing around the component. This option removes this padding. Note that both the `inverse` and `inverse_compress` options must be supplied.
360
362
  data:
@@ -375,6 +377,8 @@ examples:
375
377
  see_updates_link: true
376
378
  other:
377
379
  Applies to: England, Scotland, and Wales (see detailed guidance for <a href="http://www.dardni.gov.uk/news-dard-pa022-a-13-new-procedure-for" rel="external">Northern Ireland</a>)
380
+ context:
381
+ dark_background: true
378
382
  with_custom_margin_bottom:
379
383
  description: |
380
384
  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 the `margin-bottom` values defined in the [responsive-bottom-margin mixin](https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss#L1)
@@ -382,10 +386,10 @@ examples:
382
386
  first_published: 14 June 2014
383
387
  last_updated: 10 September 2015
384
388
  margin_bottom: 2
385
- with_ga4_tracking:
389
+ without_ga4_tracking:
386
390
  description: |
387
- Enables the GA4 link tracker on the 'See all updates' link.
391
+ Disables the GA4 link tracker on the 'See all updates' link. Tracking is enabled by default.
388
392
  data:
389
393
  last_updated: 10 September 2015
390
394
  see_updates_link: true
391
- ga4_tracking: true
395
+ disable_ga4: true
@@ -32,11 +32,11 @@ examples:
32
32
  app_name: Skittles Maker
33
33
  phase: beta
34
34
  inverse: true
35
- with_ga4_tracking:
35
+ without_ga4_tracking:
36
36
  description: |
37
- Enables GA4 tracking on the banner. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
37
+ Disables GA4 tracking on the banner. Tracking is enabled by default. This includes link tracking on the component itself, and allows pageviews to record the presence of the banner on page load.
38
38
  data:
39
39
  app_name: Skittles Maker
40
40
  phase: beta
41
41
  inverse: true
42
- ga4_tracking: true
42
+ disable_ga4: true
@@ -64,10 +64,10 @@ examples:
64
64
  url: next-page
65
65
  title: Next
66
66
  label: 'Driver CPC part 1 test: theory'
67
- with_ga4_tracking:
68
- description: Enables the GA4 link tracker on the links.
67
+ without_ga4_tracking:
68
+ description: Disables the GA4 link tracker on the links. Tracking is enabled by default.
69
69
  data:
70
- ga4_tracking: true
70
+ disable_ga4: true
71
71
  previous_page:
72
72
  url: previous-page
73
73
  title: Previous
@@ -306,10 +306,10 @@ examples:
306
306
  title: "Student loans: terms and conditions 2017 to 2018 (PDF, 136KB)"
307
307
  - title: The Student Room repaying your student loan
308
308
  url: https://www.thestudentroom.co.uk/content.php?r=5967-Repaying-your-student-loan
309
- with_ga4_tracking:
310
- description: Adds Google Analytics 4 tracking to the component, using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md).
309
+ without_ga4_tracking:
310
+ description: Disables GA4 tracking on the banner. Tracking is enabled by default and uses the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md).
311
311
  data:
312
- ga4_tracking: true
312
+ disable_ga4: true
313
313
  content_item:
314
314
  links:
315
315
  ordered_related_items:
@@ -352,4 +352,3 @@ examples:
352
352
  base_path: /world/chile/news
353
353
  - title: China
354
354
  base_path: /world/China/news
355
-
@@ -72,17 +72,13 @@ examples:
72
72
  ]
73
73
  }
74
74
  ]
75
- with_google_analytics_4_tracking:
75
+ without_google_analytics_4_tracking:
76
76
  description: |
77
- The ga4_tracking boolean allows you to add Google Analytics 4 (GA4) tracking to your component.
78
- Setting this to true will add the `ga4-event-tracker` module to your component. The JavaScript will then add a `data-ga4-event` attribute and `data-ga4-expandable` attribute to the "Show all steps" button, and each clickable Step heading.
79
- GA4 will then track these elements when they are expanded or collapsed.
80
- `data-ga4-event` contains a JSON with event data relevant to our tracking. `data-ga4-expandable` enables the value of `aria-expanded` to be captured.
81
- See the [ga4-event-tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) docs for more information.
82
- Links are also tracked with the [ga4-link-tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md).
83
- Therefore the `ga4-link-tracker` data module also exists on these step by step components. Any links will contain a data attribute of `ga4-link`, which contains the relevant tracking data as a JSON.
77
+ Disables GA4 tracking on the component. Tracking is enabled by default. This includes the [ga4-event-tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) module as well as `data-ga4-event` and `data-ga4-expandable` attributes on the "Show all steps" button, and each clickable Step heading. `data-ga4-event` contains JSON with event data relevant to tracking. `data-ga4-expandable` enables the value of `aria-expanded` to be captured.
78
+
79
+ Links within steps are tracked with the [ga4-link-tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md). Links are given a data attribute of `ga4-link`, which contains the relevant tracking data as JSON.
84
80
  data:
85
- ga4_tracking: true
81
+ disable_ga4: true
86
82
  steps: [
87
83
  {
88
84
  title: "Do something",
@@ -128,7 +124,7 @@ examples:
128
124
  ]
129
125
  with_unique_tracking:
130
126
  description: |
131
- 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 page.
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.
132
128
 
133
129
  This includes show/hide all, show/hide step and any link clicks.
134
130
  data:
@@ -531,7 +527,7 @@ examples:
531
527
 
532
528
  No change. Active step by step will be expanded.
533
529
 
534
- 4. Content item is part of multiple primary step by steps and a single secondary step by step
530
+ 4. Content item is part of multiple primary step by steps and a single secondary step by step
535
531
 
536
532
  No change. Show "Part of" step by steps list. Secondary step by step won't be shown.
537
533
 
@@ -51,9 +51,9 @@ examples:
51
51
  tracking_action: "customTrackingAction"
52
52
  tracking_label: "customTrackingLabel"
53
53
  tracking_dimension_enabled: false
54
- with_ga4_tracking:
55
- description: The ga4_tracking boolean allows you to add Google Analytics 4 (GA4) tracking to your component. Setting this to true will add the `ga4-link-tracker` module to your component. The JavaScript will then add a `data-ga4-link` attribute which contains a JSON object with data relevant to our tracking. 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.
54
+ without_ga4_tracking:
55
+ 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
56
  data:
57
- ga4_tracking: true
57
+ disable_ga4: true
58
58
  title: 'Learn to drive a motorbike: step by step'
59
59
  path: /learn-to-drive-a-motorbike
@@ -64,7 +64,7 @@ examples:
64
64
  ]
65
65
  always_display_as_a_list:
66
66
  description: |
67
- when this component is rendered alongside an expanded step by step, we want it to render as a heading.
67
+ when this component is rendered alongside an expanded step by step, we want it to render as a heading.
68
68
  However, in some cases the component will not be followed by a step by step, for example [Book Driving Test](https://www.gov.uk/book-driving-test).
69
69
  In these cases, the heading is not followed by any content, so it should be rendered as a list instead.
70
70
  data:
@@ -76,10 +76,10 @@ examples:
76
76
  text: 'Learn to drive a motorbike: step by step'
77
77
  }
78
78
  ]
79
- with_ga4_tracking:
80
- description: The ga4_tracking boolean allows you to add Google Analytics 4 (GA4) tracking to your component. Setting this to true will add the `ga4-link-tracker` module to your component. The JavaScript will then add a `data-ga4-link` attribute which contains a JSON object with data relevant to our tracking. 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.
79
+ without_ga4_tracking:
80
+ description: Disables GA4 tracking on the component. 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.
81
81
  data:
82
- ga4_tracking: true
82
+ disable_ga4: true
83
83
  pretitle: 'Example pretitle'
84
84
  links: [
85
85
  {
@@ -95,10 +95,10 @@ examples:
95
95
  tracking: GTM-123AB
96
96
  content: |
97
97
  <p class="govuk-body-m">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam congue elementum commodo. Vestibulum elit turpis, efficitur quis posuere vitae, commodo vitae augue. Donec ut pharetra ligula. Phasellus ac mauris eu felis bibendum dapibus rutrum sed quam. Pellentesque posuere ante id consequat pretium.</p>
98
- with_ga4_tracking_on_tabs:
99
- description: Enables GA4 tracking by adding the event tracker and required data attributes to the tabs. See the [ga4-event-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) for more information.
98
+ without_ga4_tracking_on_tabs:
99
+ description: Disables GA4 tracking on tabs. Tracking is enabled by default. This includes the event tracker and required data attributes. See the [ga4-event-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-event-tracker.md) for more information.
100
100
  data:
101
- ga4_tracking: true
101
+ disable_ga4: true
102
102
  tabs:
103
103
  - id: "tab-with-ga4-tracking-1"
104
104
  label: "First section"
@@ -110,8 +110,8 @@ examples:
110
110
  title: "Second section"
111
111
  content: |
112
112
  <p class="govuk-body-m">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam congue elementum commodo. Vestibulum elit turpis, efficitur quis posuere vitae, commodo vitae augue. Donec ut pharetra ligula. Phasellus ac mauris eu felis bibendum dapibus rutrum sed quam. Pellentesque posuere ante id consequat pretium.</p>
113
- with_ga4_tracking_on_tabs_as_links:
114
- description: Enables GA4 tracking by adding the link tracker and required data attributes to the tabs. See the [ga4-link-tracker documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md) for more information.
113
+ without_ga4_tracking_on_tabs_as_links:
114
+ description: Disables GA4 tracking on tabs as links. Tracking is enabled by default.
115
115
  data:
116
116
  as_links: true
117
117
  ga4_tracking: true
@@ -40,7 +40,7 @@
40
40
  index_section_count: "#{section_count}",
41
41
  index_total: "#{index_total}",
42
42
  section: ga4_heading_text,
43
- } if ga4_tracking
43
+ } unless disable_ga4
44
44
  link_element = link_to(
45
45
  link[:text],
46
46
  link[:path],
@@ -69,13 +69,13 @@
69
69
  <% if links.length > section_link_limit %>
70
70
  <%
71
71
  classes = "gem-c-related-navigation__link toggle-wrap"
72
- data_attributes_li = { module: "ga4-event-tracker" } if ga4_tracking
72
+ data_attributes_li = { module: "ga4-event-tracker" } unless disable_ga4
73
73
  data_attributes_link = {
74
74
  controls: "toggle_#{section_title}",
75
75
  expanded: "false",
76
76
  toggled_text: t("common.toggle_less")
77
77
  }
78
- data_attributes_link[:ga4_event] = { "event_name": "select_content", "type": "related content" } if ga4_tracking
78
+ data_attributes_link[:ga4_event] = { "event_name": "select_content", "type": "related content" } unless disable_ga4
79
79
  %>
80
80
  <%= tag.li(class: classes, data: data_attributes_li) do %>
81
81
  <%= link_to("#", class: "gem-c-related-navigation__toggle", data: data_attributes_link) do %>
@@ -3,11 +3,11 @@ module GovukPublishingComponents
3
3
  class BreadcrumbSelector
4
4
  attr_reader :content_item, :request, :prioritise_taxon_breadcrumbs
5
5
 
6
- def initialize(content_item, request, prioritise_taxon_breadcrumbs, ga4_tracking)
6
+ def initialize(content_item, request, prioritise_taxon_breadcrumbs, disable_ga4)
7
7
  @content_item = content_item
8
8
  @request = request
9
9
  @prioritise_taxon_breadcrumbs = prioritise_taxon_breadcrumbs
10
- @ga4_tracking = ga4_tracking
10
+ @disable_ga4 = disable_ga4
11
11
  end
12
12
 
13
13
  def breadcrumbs
@@ -38,7 +38,7 @@ module GovukPublishingComponents
38
38
  elsif navigation.content_tagged_to_current_step_by_step?
39
39
  {
40
40
  step_by_step: true,
41
- breadcrumbs: navigation.step_nav_helper.header(@ga4_tracking),
41
+ breadcrumbs: navigation.step_nav_helper.header(@disable_ga4),
42
42
  }
43
43
  elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs
44
44
  {
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.21.3".freeze
2
+ VERSION = "35.22.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.21.3
4
+ version: 35.22.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-11-08 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -1478,7 +1478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1478
1478
  - !ruby/object:Gem::Version
1479
1479
  version: '0'
1480
1480
  requirements: []
1481
- rubygems_version: 3.4.21
1481
+ rubygems_version: 3.4.22
1482
1482
  signing_key:
1483
1483
  specification_version: 4
1484
1484
  summary: A gem to document components in GOV.UK frontend applications