PageSourceSearch

https://weinportugalshop.de/modules/datalayertagmanager//views/js/blockcookie.js

js weinportugalshop.de collected 2026-10-04 02:14:45 UTC 9,120 bytes, 254 lines download raw bytes

1/**
2 * Copyright since 2026 Ecom Experts
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License version 3.0
7 * that is bundled with this package in the file LICENSE.md.
8 * It is also available through the world-wide-web at this URL:
9 * https://opensource.org/licenses/AFL-3.0
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * @author    Ecom Experts <[email protected]>
15 * @copyright Since 2026 Ecom Experts
16 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
17 */
18
19var _ddCookieFlags = (location.protocol === 'https:') ? '; SameSite=Lax; Secure' : '; SameSite=Lax';
20document.cookie = "ad_storage=denied; max-age=12000; path=/" + _ddCookieFlags;
21document.cookie = "analytics_storage=denied; max-age=12000; path=/" + _ddCookieFlags;
22document.cookie = "fb_consent=false; max-age=12000; path=/" + _ddCookieFlags;
23document.cookie = "personalization_storage=denied; max-age=12000; path=/" + _ddCookieFlags;
24document.cookie = "functionality_storage=denied; max-age=12000; path=/" + _ddCookieFlags;
25document.cookie = "security_storage=denied; max-age=12000; path=/" + _ddCookieFlags;
26document.cookie = "ad_user_data=denied; max-age=12000; path=/" + _ddCookieFlags;
27document.cookie = "ad_personalization=denied; max-age=12000; path=/" + _ddCookieFlags;
28
29var _ddConsentCookies = ['datalayercookie','ad_storage','analytics_storage','fb_consent','personalization_storage','functionality_storage','security_storage','ad_user_data','ad_personalization','consentcookie','_ga','_gid','_gat','_fbp','_fbc'];
30
31jQuery(document).ready(function (e) {
32	gtag('js', new Date());
33	if (typeof idgav4 !== 'undefined') gtag('config', idgav4);
34	if (typeof idtagmanager !== 'undefined') gtag('config', idtagmanager);
35
36	$('#openpopup').on('click', function (event) {
37		$('#cookieDataLayer').modal('show');
38	});
39
40	var miCookie = readCookie("datalayercookie");
41	if (miCookie === null) {
42		$('#cookieDataLayer').modal('show');
43	}
44
45	$('#acuerdo').on('click', function () {
46		$('#cookieDataLayer').modal('hide');
47
48		var consent = {
49			'ad_storage': 'granted',
50			'personalization_storage': 'granted',
51			'functionality_storage': 'granted',
52			'security_storage': 'granted',
53			'ad_user_data': 'granted',
54			'ad_personalization': 'granted',
55			'analytics_storage': 'granted'
56		};
57		gtag('consent', 'update', consent);
58		if (typeof fbq === 'function') { try { fbq('consent', 'grant'); } catch(e){} }
59
60		if (typeof idgav4 !== 'undefined') window['ga-disable-' + idgav4] = false;
61		if (typeof idgav3 !== 'undefined') window['ga-disable-' + idgav3] = false;
62		gtag('set', 'allow_ad_personalization_signals', true);
63
64		if (typeof indexga !== 'undefined' && indexga >= 1 && indexga <= 5) {
65			var group = {};
66			group['content_group' + indexga] = String(pagetype);
67			gtag('set', group);
68		}
69
70		setCookie('datalayercookie', '1');
71		setCookie('analytics_storage', 'granted');
72		setCookie('ad_storage', 'granted');
73		setCookie('fb_consent', 'true');
74		setCookie('personalization_storage', 'granted');
75		setCookie('functionality_storage', 'granted');
76		setCookie('security_storage', 'granted');
77		setCookie('ad_user_data', 'granted');
78		setCookie('ad_personalization', 'granted');
79
80		setTimeout(function () {
81			dataLayer.push({ 'event': 'gtm.init_consent' });
82		}, 0);
83
84		saveconsent();
85	});
86
87	$('#denegar').on('click', function (event) {
88		deleteAllCookies();
89		if (typeof idgav4 !== 'undefined') window['ga-disable-' + idgav4] = true;
90		if (typeof idgav3 !== 'undefined') window['ga-disable-' + idgav3] = true;
91		$('#cookieDataLayer').modal('hide');
92		if (typeof idgav4 !== 'undefined') gtag('config', idgav4, { 'anonymize_ip': true });
93		if (typeof idgav3 !== 'undefined') gtag('config', idgav3, { 'anonymize_ip': true });
94		gtag('consent', 'update', {
95			'ad_storage': 'denied',
96			'analytics_storage': 'denied',
97			'personalization_storage': 'denied',
98			'functionality_storage': 'denied',
99			'security_storage': 'denied',
100			'ad_user_data': 'denied',
101			'ad_personalization': 'denied'
102		});
103		if (typeof fbq === 'function') { try { fbq('consent', 'revoke'); } catch(e){} }
104
105		setCookie('datalayercookie', '0', 431000);
106		setCookie('ad_storage', 'denied', 432000);
107		setCookie('analytics_storage', 'denied', 432000);
108		setCookie('fb_consent', 'false');
109		setCookie('personalization_storage', 'denied', 431000);
110		setCookie('functionality_storage', 'denied', 431000);
111		setCookie('security_storage', 'denied', 431000);
112		setCookie('ad_user_data', 'denied', 431000);
113		setCookie('ad_personalization', 'denied', 431000);
114
115		dataLayer.push({
116			'event': 'gtm.init_consent'
117		});
118		gtag('set', 'allow_ad_personalization_signals', false);
119
120		savenoconsent();
121	});
122
123	$('#guardar').on('click', function (event) {
124		$('#cookieDataLayer').modal('hide');
125		deleteAllCookies();
126		gtag('consent', 'default', {
127			'ad_storage': 'denied',
128			'analytics_storage': 'denied',
129			'personalization_storage': 'denied',
130			'functionality_storage': 'denied',
131			'security_storage': 'denied',
132			'ad_user_data': 'denied',
133			'ad_personalization': 'denied',
134		});
135
136		dataLayer.push({
137			'event': 'gtm.init_consent'
138		});
139
140		if ($("#marketing").prop('checked') === true) {
141			setCookie('ad_storage', 'granted');
142			gtag('consent', 'update', { 'ad_storage': 'granted' });
143			setCookie('fb_consent', 'true');
144			gtag('set', 'allow_ad_personalization_signals', true);
145		} else {
146			setCookie('ad_storage', 'denied');
147			gtag('consent', 'update', { 'ad_storage': 'denied' });
148			setCookie('fb_consent', 'false');
149			gtag('set', 'allow_ad_personalization_signals', false);
150		}
151
152		if ($("#userdata").prop('checked') === true) {
153			setCookie('ad_user_data', 'granted');
154			gtag('consent', 'update', { 'ad_user_data': 'granted' });
155		} else {
156			setCookie('ad_user_data', 'denied');
157			gtag('consent', 'update', { 'ad_user_data': 'denied' });
158		}
159
160		if ($("#adpersonalization").prop('checked') === true) {
161			setCookie('ad_personalization', 'granted');
162			gtag('consent', 'update', { 'ad_personalization': 'granted' });
163			gtag('set', 'allow_ad_personalization_signals', true);
164		} else {
165			setCookie('ad_personalization', 'denied');
166			gtag('consent', 'update', { 'ad_personalization': 'denied' });
167			gtag('set', 'allow_ad_personalization_signals', false);
168		}
169
170		if ($("#analitica").prop('checked') === true) {
171			setCookie('analytics_storage', 'granted');
172			gtag('consent', 'update', { 'personalization_storage': 'granted', 'analytics_storage': 'granted' });
173			if (typeof idgav4 !== 'undefined') window['ga-disable-' + idgav4] = false;
174			if (typeof idgav3 !== 'undefined') window['ga-disable-' + idgav3] = false;
175			if (typeof indexga !== 'undefined' && indexga >= 1 && indexga <= 5) {
176				var group = {};
177				group['content_group' + indexga] = String(pagetype);
178				gtag('set', group);
179			}
180			saveconsent();
181		} else {
182			if (typeof idgav4 !== 'undefined') window['ga-disable-' + idgav4] = true;
183			if (typeof idgav3 !== 'undefined') window['ga-disable-' + idgav3] = true;
184			setCookie('analytics_storage', 'denied');
185			gtag('consent', 'update', { 'analytics_storage': 'denied' });
186			savenoconsent();
187		}
188
189		setCookie('datalayercookie', '1');
190		dataLayer.push({
191			'event': 'gtm.init_consent'
192		});
193	});
194});
195
196function deleteAllCookies() {
197	// Solo borra cookies tracking/consent; preserva sesion PrestaShop, carrito, etc.
198	var domains = ['', location.hostname.replace(/^www\./i, ''), '.' + location.hostname.replace(/^www\./i, '')];
199	for (var i = 0; i < _ddConsentCookies.length; i++) {
200		var name = _ddConsentCookies[i];
201		for (var d = 0; d < domains.length; d++) {
202			document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;domain=' + domains[d];
203		}
204	}
205	return true;
206}
207
208function readCookie(name) {
209	var nameEQ = name + "=";
210	var ca = document.cookie.split(';');
211	for (var i = 0; i < ca.length; i++) {
212		var c = ca[i];
213		while (c.charAt(0) == ' ') c = c.substring(1, c.length);
214		if (c.indexOf(nameEQ) == 0) {
215			return decodeURIComponent(c.substring(nameEQ.length, c.length));
216		}
217	}
218	return null;
219}
220
221function saveconsent() {
222	if (typeof datalayer_consent_url === 'undefined') return;
223	$.ajax({
224		type: 'POST',
225		url: datalayer_consent_url,
226		data: {
227			'action': 'saveConsent',
228			'token': (typeof tokendd !== 'undefined') ? tokendd : ''
229		},
230		dataType: "json",
231		success: function (response) {
232			document.cookie = "consentcookie=" + response + "; max-age=31536000; path=/";
233		}
234	});
235}
236
237function savenoconsent() {
238	if (typeof datalayer_consent_url === 'undefined') return;
239	$.ajax({
240		type: 'POST',
241		url: datalayer_consent_url,
242		data: {
243			'action': 'saveNoConsent',
244			'token': (typeof tokendd !== 'undefined') ? tokendd : ''
245		},
246		dataType: "json"
247	});
248}
249
250function setCookie(name, value, maxAge) {
251	if (typeof maxAge === 'undefined') maxAge = 31536000;
252	var flags = (location.protocol === 'https:') ? '; SameSite=Lax; Secure' : '; SameSite=Lax';
253	document.cookie = name + "=" + value + "; max-age=" + maxAge + "; path=/" + flags;
254}

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.