|
5 | 5 | dataLayer.push(arguments);
|
6 | 6 | }
|
7 | 7 |
|
8 |
| - // Set default consent to 'denied' as a placeholder |
9 |
| - // Determine actual values based on your own requirements |
10 |
| - gtag('consent', 'default', { |
11 |
| - ad_storage: 'denied', |
12 |
| - ad_user_data: 'denied', |
13 |
| - ad_personalization: 'denied', |
14 |
| - analytics_storage: 'denied', |
15 |
| - }); |
| 8 | + // Set default consent to 'denied' as a placeholder unless already accepted |
| 9 | + var cookiesAccepted = Cookies.get('cookiesAccepted'); |
| 10 | + if (cookiesAccepted === 'true') { |
| 11 | + gtag('consent', 'default', { |
| 12 | + ad_storage: 'granted', |
| 13 | + ad_user_data: 'granted', |
| 14 | + ad_personalization: 'granted', |
| 15 | + analytics_storage: 'granted', |
| 16 | + }); |
| 17 | + } else { |
| 18 | + gtag('consent', 'default', { |
| 19 | + ad_storage: 'denied', |
| 20 | + ad_user_data: 'denied', |
| 21 | + ad_personalization: 'denied', |
| 22 | + analytics_storage: 'denied', |
| 23 | + }); |
| 24 | + } |
16 | 25 | </script>
|
17 | 26 | <!-- Google tag (gtag.js) -->
|
18 | 27 | <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
|
0 commit comments