mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix(privacy): wire up modal
This commit is contained in:
@@ -98,6 +98,9 @@ export default {
|
|||||||
) {
|
) {
|
||||||
this.hidden = true;
|
this.hidden = true;
|
||||||
}
|
}
|
||||||
|
this.$root.$on('privacy-complete', () => {
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close () {
|
close () {
|
||||||
|
|||||||
@@ -21,7 +21,9 @@
|
|||||||
<label class="mb-0">
|
<label class="mb-0">
|
||||||
{{ $t('performanceAnalytics') }}
|
{{ $t('performanceAnalytics') }}
|
||||||
</label>
|
</label>
|
||||||
<toggle-switch />
|
<toggle-switch
|
||||||
|
v-model="privacyConsent"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<small>
|
<small>
|
||||||
{{ $t('usedForSupport') }}
|
{{ $t('usedForSupport') }}
|
||||||
@@ -44,13 +46,22 @@
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-column text-center">
|
<div class="d-flex flex-column text-center">
|
||||||
<button class="btn btn-primary mb-2">
|
<button
|
||||||
|
class="btn btn-primary mb-2"
|
||||||
|
@click="consent(true)"
|
||||||
|
>
|
||||||
{{ $t('acceptAllCookies') }}
|
{{ $t('acceptAllCookies') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary mb-2">
|
<button
|
||||||
|
class="btn btn-primary mb-2"
|
||||||
|
@click="consent(false)"
|
||||||
|
>
|
||||||
{{ $t('denyNonEssentialCookies') }}
|
{{ $t('denyNonEssentialCookies') }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary mb-3">
|
<button
|
||||||
|
class="btn btn-secondary mb-3"
|
||||||
|
@click="consent(privacyConsent)"
|
||||||
|
>
|
||||||
{{ $t('savePreferences') }}
|
{{ $t('savePreferences') }}
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
@@ -92,7 +103,17 @@ export default {
|
|||||||
closeX,
|
closeX,
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
privacyConsent: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
consent (decision) {
|
||||||
|
localStorage.setItem('analyticsConsent', decision);
|
||||||
|
this.$root.$emit('privacy-complete');
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
close () {
|
close () {
|
||||||
this.$root.$emit('bv::hide::modal', 'privacy-preferences');
|
this.$root.$emit('bv::hide::modal', 'privacy-preferences');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ export function track (properties, options = {}) {
|
|||||||
// Track events on the server by default
|
// Track events on the server by default
|
||||||
if (trackOnClient === true) {
|
if (trackOnClient === true) {
|
||||||
amplitude.getInstance().logEvent(properties.eventAction, properties);
|
amplitude.getInstance().logEvent(properties.eventAction, properties);
|
||||||
|
if (window.gtag) {
|
||||||
window.gtag('event', properties.eventAction, properties);
|
window.gtag('event', properties.eventAction, properties);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const store = getStore();
|
const store = getStore();
|
||||||
store.dispatch('analytics:trackEvent', properties);
|
store.dispatch('analytics:trackEvent', properties);
|
||||||
@@ -94,7 +96,9 @@ export function updateUser (properties = {}) {
|
|||||||
// Use nextTick to avoid blocking the UI
|
// Use nextTick to avoid blocking the UI
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
_gatherUserStats(properties);
|
_gatherUserStats(properties);
|
||||||
|
if (window.gtag) {
|
||||||
window.gtag('set', 'user_properties', properties);
|
window.gtag('set', 'user_properties', properties);
|
||||||
|
}
|
||||||
forEach(properties, (value, key) => {
|
forEach(properties, (value, key) => {
|
||||||
const identify = new amplitude.Identify().set(key, value);
|
const identify = new amplitude.Identify().set(key, value);
|
||||||
amplitude.getInstance().identify(identify);
|
amplitude.getInstance().identify(identify);
|
||||||
|
|||||||
Reference in New Issue
Block a user