Skip to content

Commit efadd4b

Browse files
committed
Added cookie consent
1 parent 9f8312c commit efadd4b

5 files changed

Lines changed: 138 additions & 13 deletions

File tree

docs/.vitepress/cache/deps/_metadata.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
11
{
2-
"hash": "0eb90bb3",
2+
"hash": "bb37bddd",
33
"configHash": "2fa44bc9",
4-
"lockfileHash": "8a716120",
5-
"browserHash": "8bde1c4a",
4+
"lockfileHash": "4c538c6c",
5+
"browserHash": "f1603d0d",
66
"optimized": {
77
"vue": {
88
"src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
99
"file": "vue.js",
10-
"fileHash": "ad72eb58",
10+
"fileHash": "23a543ee",
1111
"needsInterop": false
1212
},
1313
"vitepress > @vue/devtools-api": {
1414
"src": "../../../node_modules/@vue/devtools-api/dist/index.js",
1515
"file": "vitepress___@vue_devtools-api.js",
16-
"fileHash": "9a642018",
16+
"fileHash": "32e47d13",
1717
"needsInterop": false
1818
},
1919
"vitepress > @vueuse/core": {
2020
"src": "../../../node_modules/@vueuse/core/index.mjs",
2121
"file": "vitepress___@vueuse_core.js",
22-
"fileHash": "f8464d1d",
22+
"fileHash": "2147df0c",
2323
"needsInterop": false
2424
},
2525
"vitepress > @vueuse/integrations/useFocusTrap": {
2626
"src": "../../../node_modules/@vueuse/integrations/useFocusTrap.mjs",
2727
"file": "vitepress___@vueuse_integrations_useFocusTrap.js",
28-
"fileHash": "492c4079",
28+
"fileHash": "707bdc70",
2929
"needsInterop": false
3030
},
3131
"vitepress > mark.js/src/vanilla.js": {
3232
"src": "../../../node_modules/mark.js/src/vanilla.js",
3333
"file": "vitepress___mark__js_src_vanilla__js.js",
34-
"fileHash": "e070fb49",
34+
"fileHash": "2f20afac",
3535
"needsInterop": false
3636
},
3737
"vitepress > minisearch": {
3838
"src": "../../../node_modules/minisearch/dist/es/index.js",
3939
"file": "vitepress___minisearch.js",
40-
"fileHash": "08978cf5",
40+
"fileHash": "50b0d357",
41+
"needsInterop": false
42+
},
43+
"vanilla-cookieconsent": {
44+
"src": "../../../node_modules/vanilla-cookieconsent/dist/cookieconsent.esm.js",
45+
"file": "vanilla-cookieconsent.js",
46+
"fileHash": "e64a112a",
4147
"needsInterop": false
4248
}
4349
},

docs/.vitepress/config.mts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,26 @@ export default defineConfig({
5656
},
5757

5858
head: [
59+
[
60+
"link",
61+
{
62+
rel: "stylesheet",
63+
href: "https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.css",
64+
},
65+
],
66+
["script", { defer: "", src: "/init.js" }],
5967
[
6068
"script",
6169
{
62-
src: "https://www.googletagmanager.com/gtag/js?id=G-67G9G0VBCC",
70+
type: "text/plain",
71+
"data-category": "analytics",
6372
async: "",
73+
"data-src": "https://www.googletagmanager.com/gtag/js?id=G-67G9G0VBCC",
6474
},
6575
],
6676
[
6777
"script",
68-
{},
78+
{ type: "text/plain", "data-category": "analytics" },
6979
`
7080
window.dataLayer = window.dataLayer || [];
7181
function gtag(){dataLayer.push(arguments);}

docs/package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"docs:preview": "vitepress preview"
77
},
88
"dependencies": {
9-
"sitemap-ts": "^1.6.1"
9+
"sitemap-ts": "^1.6.1",
10+
"vanilla-cookieconsent": "^3.1.0"
1011
},
1112
"devDependencies": {
1213
"sass": "^1.89.2",

docs/public/init.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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

Comments
 (0)