govuk_publishing_components 24.15.1 → 24.15.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,8 +39,7 @@ module GovukPublishingComponents
39
39
  tracking_category: "breadcrumbClicked",
40
40
  tracking_action: tracking_action,
41
41
  tracking_label: content_item["base_path"],
42
- tracking_dimension_enabled: false,
43
- }
42
+ }.merge(custom_dimension_tracking)
44
43
  end
45
44
 
46
45
  private
@@ -80,16 +79,36 @@ module GovukPublishingComponents
80
79
  [PRIORITY_TAXONS[:brexit_business], PRIORITY_TAXONS[:brexit_individuals]]
81
80
  end
82
81
 
82
+ def brexit_taxons
83
+ brexit_child_taxons << PRIORITY_TAXONS[:brexit_taxon]
84
+ end
85
+
83
86
  def preferred_priority_taxon
84
87
  query_parameters["priority-taxon"] if query_parameters
85
88
  end
86
89
 
87
90
  def tracking_action
88
91
  action = %w[superBreadcrumb]
89
- action << "Brexitbusiness" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_business]
90
- action << "Brexitcitizen" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_individuals]
91
- action << "Brexitbusinessandcitizen" if taxon["content_id"] == PRIORITY_TAXONS[:brexit_taxon]
92
- action.join(" ")
92
+ action << page_name_for_tracking
93
+ action.compact.join(" ")
94
+ end
95
+
96
+ def custom_dimension_tracking
97
+ tracking = { tracking_dimension_enabled: false }
98
+ if brexit_taxons.include?(taxon["content_id"])
99
+ tracking[:tracking_dimension_enabled] = true
100
+ tracking[:tracking_dimension] = page_name_for_tracking
101
+ tracking[:tracking_dimension_index] = 111
102
+ end
103
+ tracking
104
+ end
105
+
106
+ def page_name_for_tracking
107
+ {
108
+ PRIORITY_TAXONS[:brexit_business] => "Brexitbusiness",
109
+ PRIORITY_TAXONS[:brexit_individuals] => "Brexitcitizen",
110
+ PRIORITY_TAXONS[:brexit_taxon] => "Brexitbusinessandcitizen",
111
+ }[taxon["content_id"]]
93
112
  end
94
113
 
95
114
  def tagged_to_both_brexit_child_taxons?
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.15.1".freeze
2
+ VERSION = "24.15.2".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: 24.15.1
4
+ version: 24.15.2
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: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config