Skip to content

Commit

Permalink
feat: disable analytics in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Mar 29, 2018
1 parent 5bc80ac commit 94f9948
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Home/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
if (!key) return;
if (this.cards[key]) {
this.$set(this.cards[key], 'init', true);
this.$ga.event('cards', 'used', key, true);
this.$ga.event('cards', 'used', key, 2);
}
if (!data) {
if (localStorage.getItem(`cache_${key}`)) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export default {
this.cards$[key].detach(this.resize);
this.$delete(this.cards$, key);
this.setCards(key);
this.$ga.event('cards', 'delete', key, true);
this.$ga.event('cards', 'delete', key, 0);
this.$store.commit('SET_CARDS', Object.keys(this.cards));
},
addCard(key, value) {
Expand All @@ -87,7 +87,7 @@ export default {
});
this.cards$[elem.getAttribute('data-id')] = new ResizeSensor(elem, this.resize); // eslint-disable-line no-new
});
this.$ga.event('cards', 'add', key, true);
this.$ga.event('cards', 'add', key, 1);
this.$store.commit('SET_CARDS', Object.keys(this.cards));
},
handleSize() {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Settings/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
</v-menu>
</v-flex>
</v-layout>
<h4 class="headline">Google Analytics</h4>
<v-switch :label="analytics.enabled ? `On` : `Off`" v-model="analytics.enabled"></v-switch>
<Config @save="save()" :settings="settings" id="global" />
<p class="text-xs-right">Made with
<v-icon small color="red">favorite</v-icon> by
Expand Down
5 changes: 5 additions & 0 deletions src/components/Settings/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default {
from: '22:00',
to: '9:00',
},
analytics: {
enabled: true,
},
from_menu: false,
to_menu: false,
};
Expand All @@ -25,10 +28,12 @@ export default {
key: 'dark',
settings: Object.assign({}, this.dark),
});
localStorage.setItem('analytics', JSON.stringify(this.analytics.enabled));
},
},
mounted() {
this.dark = Object.assign({}, this.$store.state.settings.dark);
this.analytics.enabled = JSON.parse(localStorage.getItem('analytics') || 'true');
this.settings = this.settings.map((f) => {
if (this.$store.state.settings.global[f.name] !== undefined) {
f.value = this.$store.state.settings.global[f.name];
Expand Down
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Vue.use(VueAnalytics, {
// In Chrome extension, must close checking protocol.
set: [{ field: 'checkProtocolTask', value: null }],
router,
debug: {
sendHitTask: JSON.parse(localStorage.getItem('analytics') || 'true'),
},
});
Vue.use(Vuex);
Vue.use(Vuetify, {
Expand Down

0 comments on commit 94f9948

Please sign in to comment.