Skip to content
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

enable google analytics anonymizeIP setting #11656

Merged
merged 1 commit into from
May 8, 2018
Merged

Conversation

DanCech
Copy link
Collaborator

@DanCech DanCech commented Apr 19, 2018

Partially fixes #11739

This PR updates the google analytics code to use the anonymizeIP setting to avoid collecting the end user's IP address, this is important for GDPR compliance.

https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#anonymizeIp

It also switches from $.getScript to $.ajax for loading analytics.js so that we can avoid having jquery automatically append a timestamp query parameter which prevents the browser from caching it.

@DanCech DanCech added type/bug pr/early-feedback WIP state but looking for early feedback labels Apr 19, 2018
@DanCech DanCech added this to the 5.1 milestone Apr 19, 2018
@DanCech DanCech self-assigned this Apr 19, 2018
@DanCech DanCech requested a review from torkelo April 19, 2018 15:46
var ga = ((<any>window).ga =
(<any>window).ga ||
function() {
(ga.q = ga.q || []).push(arguments);
});
ga.l = +new Date();
ga('create', (<any>config).googleAnalyticsId, 'auto');
ga('set', 'anonymizeIp', true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a config option. Some users may have a users authorisation to collect their full IP or their users are not in EU. Maybe also GA cookie lifetime should be configurable, because GDPR.

@marefr marefr self-assigned this Apr 26, 2018
@marefr marefr self-requested a review April 26, 2018 08:53
Copy link
Member

@marefr marefr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to split this PR in two. One targeting the caching which we can include in v5.1.

The other PR for possible GDPR issues - here I would like an issue to be created so we can discuss requirements and possible solutions since we don't want to introduce new configuration options specifically for this. We still have 1 month to go before GDPR kicks in.

@@ -7,14 +7,19 @@ export class Analytics {
constructor(private $rootScope, private $location) {}

gaInit() {
$.getScript('https://www.google-analytics.com/analytics.js'); // jQuery shortcut
$.ajax({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use getscript with cache:

$.getScript({
  url: 'https://www.google-analytics.com/analytics.js',
  cache: true,
});

@marefr marefr removed this from the 5.1 milestone Apr 26, 2018
@DanCech DanCech changed the title allow analytics.js to be cached, enable anonymizeIP setting enable google analytics anonymizeIP setting Apr 26, 2018
@torkelo torkelo merged commit 93a8d8a into master May 8, 2018
@torkelo
Copy link
Member

torkelo commented May 8, 2018

merging but keeping #11739 open as this seems to only solve a small part of being GDPR compliant

@torkelo torkelo added this to the 5.2 milestone May 8, 2018
@bergquist bergquist deleted the google-analytics branch May 8, 2018 08:54
ryantxu added a commit to ryantxu/grafana that referenced this pull request May 8, 2018
* grafana/master: (29 commits)
  renames alerting engine to match other services
  allow analytics.js to be cached, enable anonymizeIP setting (grafana#11656)
  Update CHANGELOG.md
  Revert "Add baron scrollbar to a node managed by gafana (grafana#11850)"
  fixed svg background (grafana#11848)
  Add baron scrollbar to a node managed by gafana (grafana#11850)
  Fix CSS asset loading for yarn start (HMR) (grafana#11855)
  fix: fixed gometalinter issues with Discord PR
  Update CHANGELOG.md
  docs: update installation instructions targeting v5.1.1 stable
  fix root_url in docs & comments (grafana#11819)
  changelog: 5.1.1 update
  fix: loading of css url (images/fonts)
  Support for local Docker builds
  fix: removed manully added http server from inject graph as it is now a self registered service
  fix: removed unused channel
  fix: comment spell fix
  fix: fixed race condition between http.Server ListenAndServe & Shutdown, now service crash during startup correctly closes http server every time
  refactoring: lots of refactoring around server shutdown flows, making sure process is terminated when background service has crashed
  refactor: provisioning service refactoring
  ...
@marefr marefr added cherry-pick needed and removed pr/early-feedback WIP state but looking for early feedback type/bug labels May 8, 2018
ryantxu added a commit to ryantxu/grafana that referenced this pull request May 8, 2018
* grafana/master:
  renames alerting engine to match other services
  allow analytics.js to be cached, enable anonymizeIP setting (grafana#11656)
@marefr marefr modified the milestones: 5.2, 5.1.2 May 8, 2018
ryantxu added a commit to NatelEnergy/grafana that referenced this pull request May 8, 2018
* grafana/master:
  renames alerting engine to match other services
  allow analytics.js to be cached, enable anonymizeIP setting (grafana#11656)
  Update CHANGELOG.md
  Revert "Add baron scrollbar to a node managed by gafana (grafana#11850)"
marefr added a commit that referenced this pull request May 9, 2018
ryantxu added a commit to NatelEnergy/grafana that referenced this pull request May 9, 2018
* grafana/master:
  changelog: add notes about closing grafana#11862, grafana#11656
  Fix dependencies on Node v10
  Update dashboard.md
  Adding a user in a specified organisation uses the admin API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google analytics - GDPR compliance
4 participants