-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cookie privacy setting to embed via queryString parameter #13510
Conversation
@@ -20,7 +20,7 @@ def frontend_config_hash(user = current_user) | |||
google_analytics_domain: Cartodb.get_config(:google_analytics, 'domain'), | |||
hubspot_enabled: CartoDB::Hubspot::instance.enabled?, | |||
intercom_app_id: Cartodb.get_config(:intercom, 'app_id'), | |||
fullstory_enabled: Cartodb.get_config(:fullstory, 'org').present? && user && user.account_type.casecmp('FREE').zero?, | |||
fullstory_enabled: Cartodb.get_config(:fullstory, 'org').present? && user && user.account_type.casecmp('FREE').zero? && params[:cookies] != '0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [159/120]
app/helpers/application_helper.rb
Outdated
@@ -119,7 +119,7 @@ def insert_hubspot_form(form = 'newsletter') | |||
end | |||
|
|||
def insert_fullstory | |||
if Cartodb.get_config(:fullstory, 'org').present? && current_user && current_user.account_type.casecmp('FREE').zero? | |||
if Cartodb.get_config(:fullstory, 'org').present? && current_user && current_user.account_type.casecmp('FREE').zero? && params[:cookies] != '0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [147/120]
@@ -20,7 +20,7 @@ def frontend_config_hash(user = current_user) | |||
google_analytics_domain: Cartodb.get_config(:google_analytics, 'domain'), | |||
hubspot_enabled: CartoDB::Hubspot::instance.enabled?, | |||
intercom_app_id: Cartodb.get_config(:intercom, 'app_id'), | |||
fullstory_enabled: Cartodb.get_config(:fullstory, 'org').present? && user && user.account_type.casecmp('FREE').zero?, | |||
fullstory_enabled: Cartodb.get_config(:fullstory, 'org').present? && user && user.account_type.casecmp('FREE').zero? && params[:cookies] != '0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [159/120]
app/helpers/application_helper.rb
Outdated
@@ -119,7 +119,7 @@ def insert_hubspot_form(form = 'newsletter') | |||
end | |||
|
|||
def insert_fullstory | |||
if Cartodb.get_config(:fullstory, 'org').present? && current_user && current_user.account_type.casecmp('FREE').zero? | |||
if Cartodb.get_config(:fullstory, 'org').present? && current_user && current_user.account_type.casecmp('FREE').zero? && params[:cookies] != '0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [147/120]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I don't think this is affecting this use case, but there are some html with the analytics and hubspot scripts hardcoded, tracked in this issue
f0d127a
to
500409a
Compare
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "cartodb-ui", | |||
"version": "4.11.32", | |||
"version": "4.11.32-1296", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need if you only touch backend files 😄
@@ -195,6 +195,14 @@ def stub_passwords(password) | |||
response.body.should_not include("maps.google.com/maps/api/js") | |||
end | |||
|
|||
it 'does not include 3rd party scripts if cookies=0 query param is present' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests passes in the current version of master
(or if you remove cookies: '0'
here), which leads me to think that is not actually testing anything 😅
We probably need to set some configuration (Cartodb.with_config
) to temporarily enable these services in the testing environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought it was working because made it fail first but I enabled these services in my app_config.yml
, so you are right. I am going to change the test :)
0f38cba
to
9b8c919
Compare
@javitonino I have just changed the test, it should be correct now. 😀 |
This PR adds the possibility to opt out of cookies in Builder embed.
When this
Do not track
mode is enabled via the query string parameter (cookies=0
), we do not include either the Google Analytics script or the TrackJS script.I talked to @javitonino and he told me that the best way to do it was to prevent the script from inserting, instead of conditional insertion in the template as I thought at first. This behaviour will allow us to share the same behaviour in all of our views by inserting
cookies=0
query parameter.The services adding cookies in our platform are Google Analytics, Hubspot, FullStory and TrackJS. FullStory script is not currently being rendered in our embed views, but as we need to be GDPR compliant I thought it was a good idea to disable it as well.
Related to https://github.com/CartoDB/support/issues/1296