|
| 1 | +/* eslint-disable no-undef */ |
| 2 | + |
| 3 | +function loadScript(src) { |
| 4 | + return new Promise((resolve, reject) => { |
| 5 | + const s = document.createElement("script"); |
| 6 | + s.src = src; |
| 7 | + s.onload = resolve; |
| 8 | + s.onerror = reject; |
| 9 | + document.head.appendChild(s); |
| 10 | + }); |
| 11 | +} |
| 12 | + |
| 13 | +// Usage |
| 14 | +loadScript( |
| 15 | + "https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.umd.js", |
| 16 | +).then(() => { |
| 17 | + CookieConsent.run({ |
| 18 | + categories: { |
| 19 | + necessary: { enabled: true, readOnly: true }, |
| 20 | + analytics: { enabled: true }, |
| 21 | + }, |
| 22 | + language: { |
| 23 | + default: "en", |
| 24 | + translations: { |
| 25 | + en: { |
| 26 | + consentModal: { |
| 27 | + title: "We use cookies", |
| 28 | + description: |
| 29 | + "Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter are set only after your consent.", |
| 30 | + acceptAllBtn: "Accept all", |
| 31 | + acceptNecessaryBtn: "Reject all", |
| 32 | + showPreferencesBtn: "Manage individual preferences", |
| 33 | + }, |
| 34 | + preferencesModal: { |
| 35 | + title: "Cookie preferences", |
| 36 | + acceptAllBtn: "Accept all", |
| 37 | + acceptNecessaryBtn: "Reject all", |
| 38 | + savePreferencesBtn: "Accept current selection", |
| 39 | + closeIconLabel: "Close modal", |
| 40 | + sections: [ |
| 41 | + { |
| 42 | + title: "Strictly necessary cookies", |
| 43 | + description: |
| 44 | + "These cookies are essential for the proper functioning of this website. Without them, the website would not work properly.", |
| 45 | + linkedCategory: "necessary", |
| 46 | + }, |
| 47 | + { |
| 48 | + title: "Performance and analytics", |
| 49 | + description: |
| 50 | + "These cookies collect information about how you use our website. All of the data is anonymized and cannot be used to identify you.", |
| 51 | + linkedCategory: "analytics", |
| 52 | + cookieTable: { |
| 53 | + headers: { |
| 54 | + name: "Name", |
| 55 | + domain: "Domain", |
| 56 | + expiration: "Expiration", |
| 57 | + description: "Description", |
| 58 | + }, |
| 59 | + body: [ |
| 60 | + { |
| 61 | + name: "^_ga", |
| 62 | + domain: "google.com", |
| 63 | + expiration: "2 years", |
| 64 | + description: |
| 65 | + "Used to distinguish users by assigning a unique client ID.", |
| 66 | + }, |
| 67 | + { |
| 68 | + name: "^_ga_", |
| 69 | + domain: "google.com", |
| 70 | + expiration: "2 years", |
| 71 | + description: |
| 72 | + "Used by Google Analytics 4 to persist session state for a specific property.", |
| 73 | + }, |
| 74 | + { |
| 75 | + name: "^_gid", |
| 76 | + domain: "google.com", |
| 77 | + expiration: "24 hours", |
| 78 | + description: |
| 79 | + "Used to distinguish users and track user behavior for 24 hours after visiting the site.", |
| 80 | + }, |
| 81 | + { |
| 82 | + name: "^_gat", |
| 83 | + domain: "google.com", |
| 84 | + expiration: "1 minute", |
| 85 | + description: |
| 86 | + "Used to throttle the request rate to Google Analytics servers.", |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | + }, |
| 91 | + { |
| 92 | + title: "More information", |
| 93 | + description: |
| 94 | + 'For any queries regarding our cookie policy and your choices, please <a href="mailto:i.ozguradem@gmail.com">contact us</a>.', |
| 95 | + }, |
| 96 | + ], |
| 97 | + }, |
| 98 | + }, |
| 99 | + }, |
| 100 | + }, |
| 101 | + }); |
| 102 | +}); |
0 commit comments