Skip to content

Commit

Permalink
Added GA and Matomo toggle in Legal Settings in the global settings i…
Browse files Browse the repository at this point in the history
…n the BO and added GA and Matomo cookies details to the cookies policy page (according to what is configured in the BO)
  • Loading branch information
luisramos0 committed Jul 24, 2018
1 parent 0ea87de commit 5d4b7f5
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_session_desc' | t}}
%tr
%td
cookies_consent
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_consent_desc' | t}}
%tr
%td
remember_spree_user_token
Expand Down Expand Up @@ -65,6 +72,87 @@
{{ instance_hostname }}
%p
{{ 'legal.cookies_policy.essential_cookies_note' | t}}

- if Spree::Config.cookies_policy_matomo_section || Spree::Config.cookies_policy_ga_section
%h2
{{ 'legal.cookies_policy.statistics_cookies' | t}}
%p
{{ 'legal.cookies_policy.statistics_cookies_desc' | t}}

- if Spree::Config.cookies_policy_ga_section
%p
{{ 'legal.cookies_policy.statistics_cookies_analytics_desc' | t}}
- if Spree::Config.cookies_policy_matomo_section
%p
{{ 'legal.cookies_policy.statistics_cookies_matomo_desc' | t}}

%table{ng: { controller:"CookiesPolicyModalCtrl"}}
%tr
%th
{{ 'legal.cookies_policy.cookie_name' | t}}
%th
{{ 'legal.cookies_policy.cookie_domain' | t}}
%th
{{ 'legal.cookies_policy.cookie_desc' | t}}
- if Spree::Config.cookies_policy_ga_section
%tr
%td
__utma
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_analytics_utma_desc' | t}}
%tr
%td
__utmt
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_analytics_utmt_desc' | t}}
%tr
%td
__utmb
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_analytics_utmb_desc' | t}}
%tr
%td
__utmc
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_analytics_utmc_desc' | t}}
%tr
%td
__utmz
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_analytics_utmz_desc' | t}}
- if Spree::Config.cookies_policy_matomo_section
%tr
%td
_pk_ref, _pk_cvar, _pk_id and _pk_ses
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_matomo_basics_desc' | t}}
%tr
%td
_pk_hsr
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_matomo_heatmap_desc' | t}}
%tr
%td
piwik_ignore
%td
{{ instance_hostname }}
%td
{{ 'legal.cookies_policy.cookie_matomo_ignore_desc' | t}}

%h2
{{ 'legal.cookies_policy.disabling_cookies_header' | t}}
%p
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/darkswarm/cookies_banner.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
top: 20vh !important;
}

@media only screen and (min-width: 800px) {
@media only screen and (min-width: 800px) and (min-height: 400px) {
top: 40vh !important;
}

@media only screen and (min-width: 1024px) {
@media only screen and (min-width: 1024px) and (min-height: 500px) {
top: 60vh !important;
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/app_configuration_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
preference :enterprises_require_tos, :boolean, default: false
preference :privacy_policy_url, :string, default: nil
preference :cookies_consent_banner_toggle, :boolean, default: false
preference :cookies_policy_matomo_section, :boolean, default: false
preference :cookies_policy_ga_section, :boolean, default: false

# Tax Preferences
preference :products_require_tax_category, :boolean, default: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
%fieldset.legal.no-border-bottom
%legend{:align => "center"}= t('.legal_settings')
.field
= label_tag(:footer_tos_url, t(:footer_tos_url)) + tag(:br)
= label_tag(:footer_tos_url, t('.footer_tos_url')) + tag(:br)
= preference_field_tag(:footer_tos_url, Spree::Config[:footer_tos_url], type: Spree::Config.preference_type(:footer_tos_url))
.field
= preference_field_tag(:enterprises_require_tos, Spree::Config[:enterprises_require_tos], :type => Spree::Config.preference_type(:enterprises_require_tos))
= label_tag(:enterprises_require_tos, t('.enterprises_require_tos')) + tag(:br)
.field
= preference_field_tag(:cookies_consent_banner_toggle, Spree::Config[:cookies_consent_banner_toggle], :type => Spree::Config.preference_type(:cookies_consent_banner_toggle))
= label_tag(:cookies_consent_banner_toggle, t('.cookies_consent_banner_toggle')) + tag(:br)
.field
= preference_field_tag(:cookies_policy_matomo_section, Spree::Config[:cookies_policy_matomo_section], :type => Spree::Config.preference_type(:cookies_policy_matomo_section))
= label_tag(:cookies_policy_matomo_section, t('.cookies_policy_matomo_section')) + tag(:br)
.field
= preference_field_tag(:cookies_policy_ga_section, Spree::Config[:cookies_policy_ga_section], :type => Spree::Config.preference_type(:cookies_policy_ga_section))
= label_tag(:cookies_policy_ga_section, t('.cookies_policy_ga_section')) + tag(:br)
.field
= label_tag(:privacy_policy_url, t('.privacy_policy_url')) + tag(:br)
= preference_field_tag(:privacy_policy_url, Spree::Config[:privacy_policy_url], type: Spree::Config.preference_type(:privacy_policy_url))
16 changes: 16 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1260,9 +1260,22 @@ en:
cookie_domain: "Set By"
cookie_desc: "Description"
cookie_session_desc: "Used to allow the website to remember users between page visits, for exemple remember items in your cart."
cookie_consent_desc: "Used to maintain status of user consent to store cookies"
cookie_remember_me_desc: "Used if the user has requested the website to remember him. This cookie is automatically deleted after 12 days. If as a user you want that cookie to be deleted, you only need to logout. If you don’t want that cookie to be installed on your computer you shouldn’t check the “remember me” checkbox when logging in."
cookie_openstreemap_desc: "Used by our friendly open source mapping provider (OpenStreetMap) to ensure that it does not receive too many requests during a given time period, to prevent abuse of their services."
cookie_stripe_desc: "Data collected by our payment processor Stripe for fraud detection https://stripe.com/cookies-policy/legal. Not all shops use Stripe as a payment method but it is a good practice to prevent fraud to apply it to all pages. Stripe probably build a picture of which of our pages usually interact with their API and then flag anything unusual. So setting the Stripe cookie has a broader function than simply the provision of a payment method to a user. Removing it could affect the security of the service itself. You can learn more about Stripe and read its privacy policy at https://stripe.com/privacy."
statistics_cookies: "Statistics Cookies"
statistics_cookies_desc: "The following are not Strictly Necessary, but help to provide you with the best user experience by allowing us to analyse user behaviour, identify which features you use most, or don’t use, understand user experience issues, etc."
statistics_cookies_analytics_desc: "We use Google Analytics, as it was the default service connected with Spree (the e-commerce open source software that we built on) but our vision is to switch to Matomo (ex Piwik, open source analytics tool) as soon as we can."
statistics_cookies_matomo_desc: "We use Matomo (ex Piwik), an open source analytics tool."
cookie_analytics_utma_desc: "Used to distinguish users and sessions. The cookie is created when the javascript library executes and no existing __utma cookies exists. The cookie is updated every time data is sent to Google Analytics."
cookie_analytics_utmt_desc: "Used to throttle request rate."
cookie_analytics_utmb_desc: "Used to determine new sessions/visits. The cookie is created when the javascript library executes and no existing __utmb cookies exists. The cookie is updated every time data is sent to Google Analytics."
cookie_analytics_utmc_desc: "Not used in ga.js. Set for interoperability with urchin.js. Historically, this cookie operated in conjunction with the __utmb cookie to determine whether the user was in a new session/visit."
cookie_analytics_utmz_desc: "Stores the traffic source or campaign that explains how the user reached your site. The cookie is created when the javascript library executes and is updated every time data is sent to Google Analytics."
cookie_matomo_basics_desc: "Matomo first party cookies to collect statistics."
cookie_matomo_heatmap_desc: "Matomo Heatmap & Session Recording cookie."
cookie_matomo_ignore_desc: "Cookie used to exclude user from being tracked."
disabling_cookies_header: "Warning on disabling cookies"
disabling_cookies_desc: "As a user you can always allow, block or delete Open Food Network’s or any other website cookies whenever you want to through your browser’s setting control. Each browser has a different operative. Here are the links:"
disabling_cookies_firefox_link: "https://support.mozilla.org/en-US/kb/enable-and-disable-cookies-website-preferences"
Expand Down Expand Up @@ -2639,6 +2652,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using
cookies_consent_banner_toggle: "Display cookies consent banner"
privacy_policy_url: "Privacy Policy URL"
enterprises_require_tos: "Enterprises must accept Terms of Service"
cookies_policy_matomo_section: "Display Matomo section on cookies policy page"
cookies_policy_ga_section: "Display Google Analytics section on cookies policy page"
footer_tos_url: "Terms of Service URL"
checkout:
payment:
stripe:
Expand Down

0 comments on commit 5d4b7f5

Please sign in to comment.