File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,9 @@ export default {
98
98
) {
99
99
this .hidden = true ;
100
100
}
101
+ this .$root .$on (' privacy-complete' , () => {
102
+ this .close ();
103
+ });
101
104
},
102
105
methods: {
103
106
close () {
Original file line number Diff line number Diff line change 21
21
<label class =" mb-0" >
22
22
{{ $t('performanceAnalytics') }}
23
23
</label >
24
- <toggle-switch />
24
+ <toggle-switch
25
+ v-model =" privacyConsent"
26
+ />
25
27
</div >
26
28
<small >
27
29
{{ $t('usedForSupport') }}
44
46
</small >
45
47
</div >
46
48
<div class =" d-flex flex-column text-center" >
47
- <button class =" btn btn-primary mb-2" >
49
+ <button
50
+ class =" btn btn-primary mb-2"
51
+ @click =" consent(true)"
52
+ >
48
53
{{ $t('acceptAllCookies') }}
49
54
</button >
50
- <button class =" btn btn-secondary mb-2" >
55
+ <button
56
+ class =" btn btn-primary mb-2"
57
+ @click =" consent(false)"
58
+ >
51
59
{{ $t('denyNonEssentialCookies') }}
52
60
</button >
53
- <button class =" btn btn-secondary mb-3" >
61
+ <button
62
+ class =" btn btn-secondary mb-3"
63
+ @click =" consent(privacyConsent)"
64
+ >
54
65
{{ $t('savePreferences') }}
55
66
</button >
56
67
<a
@@ -92,7 +103,17 @@ export default {
92
103
closeX,
93
104
ToggleSwitch,
94
105
},
106
+ data () {
107
+ return {
108
+ privacyConsent: true ,
109
+ };
110
+ },
95
111
methods: {
112
+ consent (decision ) {
113
+ localStorage .setItem (' analyticsConsent' , decision);
114
+ this .$root .$emit (' privacy-complete' );
115
+ this .close ();
116
+ },
96
117
close () {
97
118
this .$root .$emit (' bv::hide::modal' , ' privacy-preferences' );
98
119
},
Original file line number Diff line number Diff line change @@ -80,7 +80,9 @@ export function track (properties, options = {}) {
80
80
// Track events on the server by default
81
81
if ( trackOnClient === true ) {
82
82
amplitude . getInstance ( ) . logEvent ( properties . eventAction , properties ) ;
83
- window . gtag ( 'event' , properties . eventAction , properties ) ;
83
+ if ( window . gtag ) {
84
+ window . gtag ( 'event' , properties . eventAction , properties ) ;
85
+ }
84
86
} else {
85
87
const store = getStore ( ) ;
86
88
store . dispatch ( 'analytics:trackEvent' , properties ) ;
@@ -94,7 +96,9 @@ export function updateUser (properties = {}) {
94
96
// Use nextTick to avoid blocking the UI
95
97
Vue . nextTick ( ( ) => {
96
98
_gatherUserStats ( properties ) ;
97
- window . gtag ( 'set' , 'user_properties' , properties ) ;
99
+ if ( window . gtag ) {
100
+ window . gtag ( 'set' , 'user_properties' , properties ) ;
101
+ }
98
102
forEach ( properties , ( value , key ) => {
99
103
const identify = new amplitude . Identify ( ) . set ( key , value ) ;
100
104
amplitude . getInstance ( ) . identify ( identify ) ;
You can’t perform that action at this time.
0 commit comments