Commit 5055f4f 1 parent 1fb6af7 commit 5055f4f Copy full SHA for 5055f4f
File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,18 @@ export default defineNuxtPlugin((nuxtApp) => {
11
11
provide : {
12
12
trackingInit : ( config : VidoConfig ) : void => {
13
13
if ( navigator . doNotTrack !== '1' ) {
14
- const consentIsGranted = localStorage . getItem ( 'vue-cookie-accept-decline-cookies-consent' ) === 'accept'
15
- const googleTagManagerId = config . GOOGLE_TAG_MANAGER_ID
14
+ const { GOOGLE_TAG_MANAGER_ID , COOKIES_CONSENT } = config
15
+
16
+ if ( GOOGLE_TAG_MANAGER_ID ) {
17
+ const consentIsGranted = COOKIES_CONSENT
18
+ ? localStorage . getItem ( 'vue-cookie-accept-decline-cookies-consent' ) === 'accept'
19
+ : true // Bypass consent if COOKIES_CONSENT is not enabled
16
20
17
- if ( googleTagManagerId ) {
18
21
trackers . push (
19
22
new Google (
20
23
nuxtApp . vueApp ,
21
24
! consentIsGranted ,
22
- googleTagManagerId ,
25
+ GOOGLE_TAG_MANAGER_ID ,
23
26
) ,
24
27
)
25
28
}
You can’t perform that action at this time.
0 commit comments