slimmer 3.27.0 → 3.28.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
data/lib/slimmer/headers.rb
CHANGED
@@ -13,7 +13,7 @@ module Slimmer::Processors
|
|
13
13
|
custom_vars = []
|
14
14
|
if @artefact
|
15
15
|
custom_vars << set_custom_var_downcase(1, "Section", @artefact.primary_root_section["title"]) if @artefact.primary_root_section
|
16
|
-
custom_vars <<
|
16
|
+
custom_vars << set_multivalue_custom_var(3, "NeedID", @artefact.need_ids)
|
17
17
|
custom_vars << set_custom_var_downcase(4, "Proposition", (@artefact.business_proposition ? 'business' : 'citizen')) unless @artefact.business_proposition.nil?
|
18
18
|
end
|
19
19
|
custom_vars << set_custom_var(9, "Organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER])
|
@@ -32,6 +32,11 @@ module Slimmer::Processors
|
|
32
32
|
set_custom_var(slot, name, value.downcase)
|
33
33
|
end
|
34
34
|
|
35
|
+
def set_multivalue_custom_var(slot, name, values)
|
36
|
+
return nil if values.empty?
|
37
|
+
set_custom_var(slot, name, values.join(',').downcase)
|
38
|
+
end
|
39
|
+
|
35
40
|
def set_custom_var(slot, name, value)
|
36
41
|
return nil unless value
|
37
42
|
response = "_gaq.push(#{JSON.dump([ "_setCustomVar", slot, name, value, PAGE_LEVEL_EVENT])});\n"
|
data/lib/slimmer/version.rb
CHANGED
data/test/headers_test.rb
CHANGED
@@ -14,11 +14,6 @@ class HeadersTest < MiniTest::Unit::TestCase
|
|
14
14
|
assert_equal "rhubarb", headers["X-Slimmer-Section"]
|
15
15
|
end
|
16
16
|
|
17
|
-
def test_should_set_need_id_header
|
18
|
-
set_slimmer_headers need_id: "rhubarb"
|
19
|
-
assert_equal "rhubarb", headers["X-Slimmer-Need-ID"]
|
20
|
-
end
|
21
|
-
|
22
17
|
def test_should_set_format_header
|
23
18
|
set_slimmer_headers format: "rhubarb"
|
24
19
|
assert_equal "rhubarb", headers["X-Slimmer-Format"]
|
@@ -56,7 +56,7 @@ module GoogleAnalyticsTest
|
|
56
56
|
|
57
57
|
artefact = artefact_for_slug_in_a_subsection("something", "rhubarb/in-puddings")
|
58
58
|
artefact["details"].merge!(
|
59
|
-
"
|
59
|
+
"need_ids" => [100001,100002],
|
60
60
|
"business_proposition" => true,
|
61
61
|
)
|
62
62
|
headers = {
|
@@ -82,16 +82,16 @@ module GoogleAnalyticsTest
|
|
82
82
|
assert_custom_var 2, "Format", "custard", PAGE_LEVEL_EVENT
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def test_should_set_internal_format_name_in_GOVUK_object
|
86
86
|
assert_set_var "Format", "custard", govuk
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
90
|
-
assert_custom_var 3, "NeedID", "
|
89
|
+
def test_should_pass_need_ids_to_GA
|
90
|
+
assert_custom_var 3, "NeedID", "100001,100002", PAGE_LEVEL_EVENT
|
91
91
|
end
|
92
92
|
|
93
|
-
def
|
94
|
-
assert_set_var "NeedID", "
|
93
|
+
def test_should_set_need_ids_in_GOVUK_object
|
94
|
+
assert_set_var "NeedID", "100001,100002", govuk
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_should_pass_proposition_to_GA
|
@@ -106,15 +106,15 @@ module GoogleAnalyticsTest
|
|
106
106
|
assert_custom_var 10, "WorldLocations", "<WL3>", PAGE_LEVEL_EVENT
|
107
107
|
end
|
108
108
|
|
109
|
-
def
|
110
|
-
assert_set_var "Proposition", "
|
109
|
+
def test_should_set_proposition_in_GOVUK_object
|
110
|
+
assert_set_var "Proposition", "business", govuk
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_should_pass_result_count_to_GA
|
114
114
|
assert_custom_var 5, "ResultCount", "3", PAGE_LEVEL_EVENT
|
115
115
|
end
|
116
116
|
|
117
|
-
def
|
117
|
+
def test_should_set_result_count_in_GOVUK_object
|
118
118
|
assert_set_var "ResultCount", "3", govuk
|
119
119
|
end
|
120
120
|
end
|
@@ -157,7 +157,7 @@ module GoogleAnalyticsTest
|
|
157
157
|
|
158
158
|
artefact = artefact_for_slug_in_a_subsection("something", "rhubarb/in-puddings")
|
159
159
|
artefact["details"].merge!(
|
160
|
-
"
|
160
|
+
"need_ids" => [100001, 100002],
|
161
161
|
"business_proposition" => true
|
162
162
|
)
|
163
163
|
headers = {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.28.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -341,7 +341,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
341
341
|
version: '0'
|
342
342
|
segments:
|
343
343
|
- 0
|
344
|
-
hash:
|
344
|
+
hash: -4353529555828351700
|
345
345
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
346
346
|
none: false
|
347
347
|
requirements:
|
@@ -350,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
350
|
version: '0'
|
351
351
|
segments:
|
352
352
|
- 0
|
353
|
-
hash:
|
353
|
+
hash: -4353529555828351700
|
354
354
|
requirements: []
|
355
355
|
rubyforge_project: slimmer
|
356
356
|
rubygems_version: 1.8.23
|