From 2fbe751db2c2cb3db8dc607b99106f4e1cb9dea5 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 13 Jul 2018 12:46:20 +0200 Subject: GA: Persist opt out --- src/IntroBox.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/IntroBox.vue') diff --git a/src/IntroBox.vue b/src/IntroBox.vue index d146f2f..e0a1abb 100644 --- a/src/IntroBox.vue +++ b/src/IntroBox.vue @@ -13,7 +13,7 @@ The data can be imprecise and can be contrary to your personal experience.

- This site shares visitor data with Google Analytics and Google AdSense which store cookies. If you do not want that, you can opt out of Google Analytics and opt out of targeted advertisements. + This site shares visitor data with Google Analytics and Google AdSense which store cookies. If you do not want that, you can opt out of Google Analytics (Google Analytics is disabled for you) and opt out of targeted advertisements.

@@ -28,12 +28,27 @@ export default Vue.component('intro-box', { data: function() { return { hideIntro: !!localStorage.getItem('hideIntro'), + gaOptedOut: !!localStorage.getItem('gaOptOut'), }; }, + methods: { + optOutAnalytics: function() { + this.$ga.disable(); + this.gaOptedOut = true; + }, + }, + created: function() { + if (this.gaOptedOut) { + this.$ga.disable(); + } + }, watch: { hideIntro: function(value) { localStorage.setItem('hideIntro', value); }, + gaOptedOut: function(value) { + localStorage.setItem('gaOptOut', value); + }, selectedMode: function(value) { this.hideIntro = !!localStorage.getItem('hideIntro'); }, -- cgit v1.3.1