-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Conversation
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); |
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.
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.
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.
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({ |
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.
You can use getscript with cache:
$.getScript({
url: 'https://www.google-analytics.com/analytics.js',
cache: true,
});
beeb9bd
to
ab589da
Compare
merging but keeping #11739 open as this seems to only solve a small part of being GDPR compliant |
* 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 ...
* grafana/master: renames alerting engine to match other services allow analytics.js to be cached, enable anonymizeIP setting (grafana#11656)
* 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)"
* 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
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 loadinganalytics.js
so that we can avoid having jquery automatically append a timestamp query parameter which prevents the browser from caching it.