1 2class GTagConsent { 3 4 static consentState = { 5 ad_storage: "denied", 6 analytics_storage: "denied", 7 ad_user_data: "denied", 8 ad_personalization: "denied", 9 wait_for_update: 500 10 } 11 12 static init( data = null ) { 13 if( data != null ){ 14 this.consentState = data 15 } 16 this.store(this.consentState) 17 } 18 19 static store( data, action = 'default' ) { 20 this.consentState = data 21 if ( typeof gtag === 'function' ) { 22 gtag("consent", action, data); 23 gtag("set", "ads_data_redaction", true); 24 gtag("set", "developer_id.dMmY1Mm", true); 25 } 26 } 27 28 static accept() { 29 this.store({ 30 ad_storage: "granted", 31 analytics_storage: "granted", 32 ad_user_data: "granted", 33 ad_personalization: "granted" 34 }, 'update') 35 } 36 37 static decline() { 38 this.store({ 39 ad_storage: "denied", 40 analytics_storage: "denied", 41 ad_user_data: "denied", 42 ad_personalization: "denied" 43 }, 'update') 44 } 45 46 static tagGet( key, def = 'denied') 47 { 48 if ( !window["google_tag_data"] ) { 49 return def; 50 } 51 52 var g = "ics" in google_tag_data ? google_tag_data.ics.entries : null; 53 if( !g[key] ){ 54 return def; 55 } 56 var l = s => s == undefined ? def : s ? "granted" : "denied"; 57 58 if( l(g[key]['update']) != "" ){ 59 return l(g[key]['update']); 60 }else if(g[key]['update']) { 61 return l(g[key]['update']); 62 } 63 64 return def; 65 } 66 67 static tagAll() 68 { 69 var gtagConsents = [] 70 if ( !window["google_tag_data"] ) { 71 return gtagConsents; 72 } 73 var l = s => s == undefined ? "" : s ? "granted" : "denied"; 74 75 var g = "ics" in google_tag_data ? google_tag_data.ics.entries : null; 76 for (var a in g) { 77 if( l(g[a]['update']) != "" ) { 78 gtagConsents[a] = l(g[a]['update']) 79 }else{ 80 gtagConsents[a] = l(g[a]['default']) 81 } 82 } 83 return gtagConsents; 84 } 85 86 static get( key, def = 'denied', rBool = false ) { 87 if ( !this.consentState[key] ) { 88 return def; 89 } 90 if( rBool ){ 91 return this.consentState[key] == 'denied' ? false : true 92 } else { 93 return this.consentState[key] 94 } 95 } 96 97 static all() { 98 return this.consentState 99 } 100 101}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.