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 {
9898 ) {
9999 this .hidden = true ;
100100 }
101+ this .$root .$on (' privacy-complete' , () => {
102+ this .close ();
103+ });
101104 },
102105 methods: {
103106 close () {
Original file line number Diff line number Diff line change 2121 <label class =" mb-0" >
2222 {{ $t('performanceAnalytics') }}
2323 </label >
24- <toggle-switch />
24+ <toggle-switch
25+ v-model =" privacyConsent"
26+ />
2527 </div >
2628 <small >
2729 {{ $t('usedForSupport') }}
4446 </small >
4547 </div >
4648 <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+ >
4853 {{ $t('acceptAllCookies') }}
4954 </button >
50- <button class =" btn btn-secondary mb-2" >
55+ <button
56+ class =" btn btn-primary mb-2"
57+ @click =" consent(false)"
58+ >
5159 {{ $t('denyNonEssentialCookies') }}
5260 </button >
53- <button class =" btn btn-secondary mb-3" >
61+ <button
62+ class =" btn btn-secondary mb-3"
63+ @click =" consent(privacyConsent)"
64+ >
5465 {{ $t('savePreferences') }}
5566 </button >
5667 <a
@@ -92,7 +103,17 @@ export default {
92103 closeX,
93104 ToggleSwitch,
94105 },
106+ data () {
107+ return {
108+ privacyConsent: true ,
109+ };
110+ },
95111 methods: {
112+ consent (decision ) {
113+ localStorage .setItem (' analyticsConsent' , decision);
114+ this .$root .$emit (' privacy-complete' );
115+ this .close ();
116+ },
96117 close () {
97118 this .$root .$emit (' bv::hide::modal' , ' privacy-preferences' );
98119 },
Original file line number Diff line number Diff line change @@ -80,7 +80,9 @@ export function track (properties, options = {}) {
8080 // Track events on the server by default
8181 if ( trackOnClient === true ) {
8282 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+ }
8486 } else {
8587 const store = getStore ( ) ;
8688 store . dispatch ( 'analytics:trackEvent' , properties ) ;
@@ -94,7 +96,9 @@ export function updateUser (properties = {}) {
9496 // Use nextTick to avoid blocking the UI
9597 Vue . nextTick ( ( ) => {
9698 _gatherUserStats ( properties ) ;
97- window . gtag ( 'set' , 'user_properties' , properties ) ;
99+ if ( window . gtag ) {
100+ window . gtag ( 'set' , 'user_properties' , properties ) ;
101+ }
98102 forEach ( properties , ( value , key ) => {
99103 const identify = new amplitude . Identify ( ) . set ( key , value ) ;
100104 amplitude . getInstance ( ) . identify ( identify ) ;
You can’t perform that action at this time.
0 commit comments