Skip to content

Commit 46b5e4e

Browse files
feat: major upgrade to v1.1.0 of cookie preferences gem
This sets the analytics tracking by default until a user rejects the cookies. It also introduces a new 'survey' cookies category which is currently used for Ethnio.
1 parent 80ffaa0 commit 46b5e4e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ gem "citizens_advice_components",
4343

4444
gem "citizens_advice_cookie_preferences",
4545
github: "citizensadvice/cookie-preferences",
46-
tag: "v0.5.0"
46+
tag: "v1.1.0"
4747

4848
# The citizens_advice_components gem uses view component but we also use this to write
4949
# our app components so explicitly name it as an application dependency.

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ GIT
2121

2222
GIT
2323
remote: https://github.com/citizensadvice/cookie-preferences.git
24-
revision: a98fb04be831fcb9e7692010a64100c976ebd5c6
25-
tag: v0.5.0
24+
revision: 34f3cde1b47b7c87d4cbd894d48e5d7137105902
25+
tag: v1.1.0
2626
specs:
27-
citizens_advice_cookie_preferences (0.5.0)
27+
citizens_advice_cookie_preferences (1.1.0)
2828
addressable (~> 2.7)
2929
citizens_advice_components (> 8.0.0)
3030
meta-tags

app/controllers/concerns/data_layer.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ def default_data_layer_properties
2727
language: (helpers.current_country || "england").to_s.capitalize
2828
}
2929

30+
properties[:surveyCookiesAccepted] = "true" if allow_survey_cookies?
31+
32+
# If the user has accepted cookies the dlv is set to explicit
3033
if allow_analytics_cookies?
31-
properties.merge({ analyticsCookiesAccepted: "True" })
32-
else
33-
properties
34+
properties[:analyticsCookiesAccepted] = cookies[:cookie_preference_set].present? ? "explicit" : "default"
3435
end
36+
37+
properties
3538
end
3639
end

0 commit comments

Comments
 (0)