Compare commits
No commits in common. "6a0ee958fb0b7dfd02bf4e5bba2442d627cd07c4" and "35c1b7b5747d3a243b4bc83e611b6a8ff7cfa030" have entirely different histories.
6a0ee958fb
...
35c1b7b574
5 changed files with 157 additions and 23 deletions
81
src/components/CookieBanner.astro
Normal file
81
src/components/CookieBanner.astro
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
---
|
||||
// Own cookie banner (no iubenda). Not a cookie wall: a floating card, the site
|
||||
// stays usable behind it. Reject and Accept have the same weight. The only
|
||||
// thing that needs consent is Google Analytics, loaded by window.loadAnalytics
|
||||
// (BaseLayout) only after "Accept".
|
||||
---
|
||||
|
||||
<section
|
||||
id="cookie-banner"
|
||||
aria-label="Cookie consent"
|
||||
class="hidden fixed bottom-4 left-4 right-4 sm:right-auto sm:max-w-sm bg-white dark:bg-gray-800 shadow-2xl rounded-xl p-5 border border-gray-200 dark:border-gray-700 z-50"
|
||||
style="animation: slideUp 0.3s ease-out;"
|
||||
>
|
||||
<p class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-2">Cookies, in short</p>
|
||||
<p class="text-xs leading-relaxed text-gray-700 dark:text-gray-300 mb-4">
|
||||
The site works without cookies. If you accept, Google Analytics tells me which pages people
|
||||
read. If you reject, nothing changes for you.
|
||||
<a href="/cookie-policy" class="underline hover:text-gray-900 dark:hover:text-white"
|
||||
>Cookie Policy</a
|
||||
>
|
||||
</p>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
id="cookie-reject"
|
||||
class="flex-1 px-3 py-2 bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900 text-xs font-medium rounded-lg hover:opacity-90 transition-opacity"
|
||||
>
|
||||
Reject
|
||||
</button>
|
||||
<button
|
||||
id="cookie-accept"
|
||||
class="flex-1 px-3 py-2 bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900 text-xs font-medium rounded-lg hover:opacity-90 transition-opacity"
|
||||
>
|
||||
Accept
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script is:inline>
|
||||
(function () {
|
||||
var banner = document.getElementById("cookie-banner");
|
||||
if (!banner) return;
|
||||
|
||||
var choose = function (value) {
|
||||
try {
|
||||
localStorage.setItem("cookieConsent", value);
|
||||
localStorage.setItem("cookieConsentDate", String(Date.now()));
|
||||
} catch (e) {}
|
||||
banner.classList.add("hidden");
|
||||
if (value === "accepted") {
|
||||
window.loadAnalytics && window.loadAnalytics();
|
||||
} else {
|
||||
// Consent withdrawn: drop the Google Analytics cookies already set
|
||||
document.cookie.split(";").forEach(function (raw) {
|
||||
var name = raw.split("=")[0].trim();
|
||||
if (name.indexOf("_ga") !== 0) return;
|
||||
var host = location.hostname.replace(/^www\./, "");
|
||||
["", "; domain=" + host, "; domain=." + host].forEach(function (domain) {
|
||||
document.cookie = name + "=; Max-Age=0; path=/" + domain;
|
||||
});
|
||||
});
|
||||
}
|
||||
window.dispatchEvent(new Event("cookie-consent"));
|
||||
};
|
||||
|
||||
document.getElementById("cookie-accept").addEventListener("click", function () {
|
||||
choose("accepted");
|
||||
});
|
||||
document.getElementById("cookie-reject").addEventListener("click", function () {
|
||||
choose("rejected");
|
||||
});
|
||||
|
||||
// Footer "Cookie settings" reopens the banner
|
||||
window.openCookieSettings = function () {
|
||||
banner.classList.remove("hidden");
|
||||
};
|
||||
|
||||
if (!window.getCookieConsent || !window.getCookieConsent()) {
|
||||
banner.classList.remove("hidden");
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
|
@ -38,6 +38,14 @@ const maxWidth = width === "7xl" ? "max-w-7xl" : "max-w-4xl";
|
|||
<a href="/cookie-policy" class="transition-colors duration-200 hover:text-gray-600 dark:hover:text-gray-300" title="Cookie Policy"
|
||||
>Cookie Policy</a
|
||||
>
|
||||
<span class="text-gray-800 dark:text-gray-400">•</span>
|
||||
<button
|
||||
type="button"
|
||||
onclick="window.openCookieSettings && window.openCookieSettings()"
|
||||
class="transition-colors duration-200 hover:text-gray-600 dark:hover:text-gray-300"
|
||||
>
|
||||
Cookie settings
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center sm:text-right text-gray-800 dark:text-gray-200 text-xs">
|
||||
|
|
|
|||
|
|
@ -32,20 +32,42 @@ const fullImageUrl = image
|
|||
: `${siteUrl}${image}`
|
||||
: `${siteUrl}${defaultImage}`;
|
||||
const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`;
|
||||
import CookieBanner from "../components/CookieBanner.astro";
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<script
|
||||
is:inline
|
||||
defer
|
||||
src="https://stats.lorenzoiovino.com/s.js"
|
||||
data-website-id="a9169043-dae9-4762-94e3-0c8286e2c6cc"
|
||||
data-domains="lorenzoiovino.com,www.lorenzoiovino.com"
|
||||
data-do-not-track="true"
|
||||
></script>
|
||||
<script is:inline>
|
||||
// Google Analytics only after consent (CookieBanner). The choice lasts
|
||||
// 6 months, then the banner asks again.
|
||||
window.getCookieConsent = function () {
|
||||
try {
|
||||
var value = localStorage.getItem("cookieConsent");
|
||||
var date = Number(localStorage.getItem("cookieConsentDate") || 0);
|
||||
if (!value || Date.now() - date > 180 * 24 * 60 * 60 * 1000) return null;
|
||||
return value;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
window.loadAnalytics = function () {
|
||||
if (window.__gaLoaded) return;
|
||||
window.__gaLoaded = true;
|
||||
var script = document.createElement("script");
|
||||
script.async = true;
|
||||
script.src = "https://www.googletagmanager.com/gtag/js?id=G-SPLW5RY3HD";
|
||||
document.head.appendChild(script);
|
||||
gtag("js", new Date());
|
||||
gtag("config", "G-SPLW5RY3HD");
|
||||
};
|
||||
if (window.getCookieConsent() === "accepted") window.loadAnalytics();
|
||||
</script>
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
|
@ -185,6 +207,8 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`;
|
|||
<body class="bg-white dark:bg-gray-900 min-h-screen transition-colors duration-200">
|
||||
<slot />
|
||||
|
||||
<CookieBanner />
|
||||
|
||||
<!-- Dark Mode Suggestion Toast -->
|
||||
<div
|
||||
id="dark-mode-toast"
|
||||
|
|
@ -269,7 +293,18 @@ const fullCanonicalUrl = canonicalUrl || `${siteUrl}${Astro.url.pathname}`;
|
|||
const hasBeenDismissed = localStorage.getItem(TOAST_DISMISSED_KEY);
|
||||
|
||||
// Only show toast if user is in light mode and hasn't dismissed it
|
||||
// Never on top of the cookie banner: if it's open, wait for the answer
|
||||
const bannerOpen = () => {
|
||||
const banner = document.getElementById("cookie-banner");
|
||||
return !!banner && !banner.classList.contains("hidden");
|
||||
};
|
||||
const showToast = () => {
|
||||
if (bannerOpen()) {
|
||||
window.addEventListener("cookie-consent", () => setTimeout(showToast, 1500), {
|
||||
once: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const isDarkMode = document.documentElement.classList.contains("dark");
|
||||
if (!isDarkMode && !hasBeenDismissed && toast) {
|
||||
toast.classList.remove("hidden");
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
layout: ../layouts/LegalLayout.astro
|
||||
title: "Cookie Policy"
|
||||
description: "Which cookies and local storage lorenzoiovino.com uses."
|
||||
updated: "October 2, 2026"
|
||||
description: "Which cookies and local storage lorenzoiovino.com uses and how to change your choice."
|
||||
updated: "September 29, 2026"
|
||||
---
|
||||
|
||||
The site sets no cookies. That's why there is no cookie banner.
|
||||
The site works without cookies. Analytics cookies are set only if you accept them.
|
||||
|
||||
## Technical storage
|
||||
## Technical storage (always on)
|
||||
|
||||
The site saves a few small values in your browser's local storage. They don't track you and are never sent to anyone. They only remember your choices:
|
||||
|
||||
|
|
@ -15,20 +15,28 @@ The site saves a few small values in your browser's local storage. They don't tr
|
|||
|---|---|---|
|
||||
| `theme` | light or dark mode | until you clear it |
|
||||
| `darkModeToastDismissed` | don't show the "Try Dark Mode?" hint again | until you clear it |
|
||||
| `cookieConsent`, `cookieConsentDate` | your answer to the cookie banner | 6 months, then the banner asks again |
|
||||
|
||||
These are strictly necessary for the features you use, so they don't need consent.
|
||||
|
||||
## Visit statistics
|
||||
## Analytics cookies (only if you accept)
|
||||
|
||||
Visits are counted with **Umami**, self-hosted on my own server at OVH in France. It uses no cookies, doesn't store your IP address and shares nothing with third parties. More details are in the [Privacy Policy](/privacy-policy).
|
||||
If you click **Accept**, Google Analytics 4 sets these cookies to count visits:
|
||||
|
||||
| Name | Provider | Duration |
|
||||
|---|---|---|
|
||||
| `_ga` | Google | 2 years |
|
||||
| `_ga_<container id>` | Google | 2 years |
|
||||
|
||||
More details on how Google uses this data are in the [Privacy Policy](/privacy-policy) and in [Google's documentation](https://policies.google.com/technologies/cookies).
|
||||
|
||||
## Third-party content
|
||||
|
||||
Some blog posts embed videos from YouTube and GIFs from Giphy. These services may set their own cookies when you open those posts. They are ruled by the cookie policies of [Google](https://policies.google.com/technologies/cookies) and [Giphy](https://support.giphy.com/hc/en-us/articles/360032872931-GIPHY-Privacy-Policy).
|
||||
|
||||
## Your choice
|
||||
## Change your choice
|
||||
|
||||
You can delete cookies and local storage from your browser settings at any time.
|
||||
Use **Cookie settings** in the footer to open the banner again. If you switch from Accept to Reject, the Google Analytics cookies are deleted. You can also delete cookies and local storage from your browser settings at any time.
|
||||
|
||||
## Contact
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
layout: ../layouts/LegalLayout.astro
|
||||
title: "Privacy Policy"
|
||||
description: "What personal data lorenzoiovino.com processes, why and what your rights are."
|
||||
updated: "October 2, 2026"
|
||||
updated: "September 29, 2026"
|
||||
---
|
||||
|
||||
This is a personal website with a blog. It has no accounts, no forms and no newsletter, so it collects very little. This page explains what.
|
||||
|
|
@ -17,17 +17,19 @@ Contact: [thisloke@proton.me](mailto:thisloke@proton.me)
|
|||
|
||||
### Server logs
|
||||
|
||||
The site is hosted on a server of **OVH SAS** in Gravelines, France. Like any web server, it records technical data for every request: IP address, date and time, requested page, browser and operating system. These logs are used only to keep the site running and secure (errors, abuse, attacks) and are kept for a limited time.
|
||||
The site is hosted on a server of **OVH Srl** in Milan, Italy. Like any web server, it records technical data for every request: IP address, date and time, requested page, browser and operating system. These logs are used only to keep the site running and secure (errors, abuse, attacks) and are kept for a limited time.
|
||||
|
||||
Legal basis: legitimate interest in running a secure website (art. 6.1.f GDPR).
|
||||
|
||||
### Visit statistics
|
||||
### Google Analytics (only if you accept)
|
||||
|
||||
To count visits and see which pages people read, the site uses **Umami**, self-hosted on my own server at **OVH** in France. It sets no cookies and doesn't store your IP address. The data stays on my server and is not shared with third parties. If your browser sends a Do Not Track signal, the visit is not counted.
|
||||
If you click **Accept** on the cookie banner, the site loads **Google Analytics 4** (Google Ireland Limited / Google LLC) to count visits and see which pages people read. It uses cookies and collects usage data: pages visited, time on page, device, browser, approximate location. Google Analytics 4 does not store the full IP address.
|
||||
|
||||
Since there are no cookies and no tracking, there is no cookie banner.
|
||||
Data may be transferred to the United States. Google LLC is certified under the EU-US Data Privacy Framework.
|
||||
|
||||
Legal basis: legitimate interest in knowing which pages are read (art. 6.1.f GDPR).
|
||||
If you click **Reject**, Google Analytics is never loaded. You can change your choice at any time with **Cookie settings** in the footer.
|
||||
|
||||
Legal basis: your consent (art. 6.1.a GDPR).
|
||||
|
||||
### Google Fonts
|
||||
|
||||
|
|
@ -45,7 +47,7 @@ If you write to me, I use your email address and what you write only to answer y
|
|||
|
||||
## Your rights
|
||||
|
||||
You can ask me to access, correct or delete your data, to restrict or object to its processing and to receive it in a portable format.
|
||||
You can ask me to access, correct or delete your data, to restrict or object to its processing and to receive it in a portable format. You can withdraw your consent to analytics at any time, without affecting what happened before.
|
||||
|
||||
Write to [thisloke@proton.me](mailto:thisloke@proton.me). If you think your data is processed unlawfully, you can also file a complaint with the Italian data protection authority, the [Garante per la protezione dei dati personali](https://www.garanteprivacy.it).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue