Anonymous portfolio statistics (opens/downloads per image, cookieless) + privacy text
Counts go to customer.imagesbyolofsson.se/api/stats/hit via sendBeacon. No cookie, IP or id stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -222,6 +222,21 @@ const uniqueMonths = [...new Map(allMonths.map(item => [item.name, item])).value
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// --- ANONYM STATISTIK ---
|
||||
// Räknare per dag och bild i kundportalen: ingen cookie, ingen IP, inget id.
|
||||
const STATS_URL = 'https://customer.imagesbyolofsson.se/api/stats/hit';
|
||||
function statsItem(src: string): string {
|
||||
const file = (src.split('/').pop() || '').replace(/\.[A-Za-z0-9_-]{6,12}\.(jpe?g|webp|avif|png)$/i, '');
|
||||
return ('portfolio/' + file.replace(/[^\w\-.]/g, '_')).slice(0, 150);
|
||||
}
|
||||
function stat(kind: 'view' | 'open' | 'download', item: string) {
|
||||
try {
|
||||
const body = new Blob([JSON.stringify({ kind, item })], { type: 'text/plain' });
|
||||
navigator.sendBeacon?.(STATS_URL, body);
|
||||
} catch { /* statistik får aldrig störa sidan */ }
|
||||
}
|
||||
stat('view', 'page/portfolio');
|
||||
|
||||
// --- FILTER LOGIK ---
|
||||
// MULTI-select: flera ar + manader samtidigt. 'all' = samtligt.
|
||||
let selectedYears = new Set(['all']);
|
||||
@@ -358,6 +373,7 @@ const uniqueMonths = [...new Map(allMonths.map(item => [item.name, item])).value
|
||||
visaMeny(false);
|
||||
const url = urlForSize(size);
|
||||
if (!url) { alert('Den storleken saknas for den har bilden.'); return; }
|
||||
stat('download', statsItem(visibleItems[currentImageIndex]?.dataset.src || ''));
|
||||
if (size === 'orig') {
|
||||
// Losenordet sparas bara for fliken, aldrig i localStorage.
|
||||
const sparat = sessionStorage.getItem('dlpw');
|
||||
@@ -413,6 +429,7 @@ const uniqueMonths = [...new Map(allMonths.map(item => [item.name, item])).value
|
||||
visaMeny(false);
|
||||
|
||||
lbImg.src = item.dataset.src || '';
|
||||
stat('open', statsItem(item.dataset.src || ''));
|
||||
|
||||
if(lbDate) lbDate.innerText = item.dataset.date || '';
|
||||
if(lbModel) lbModel.innerText = item.dataset.model || '';
|
||||
|
||||
@@ -53,6 +53,15 @@ import WaveBackground from '../components/WaveBackground.astro';
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="space-y-3">
|
||||
<h2 class="text-2xl font-bold text-white">Anonymous portfolio statistics</h2>
|
||||
<p>
|
||||
To see which photos people like, the portfolio counts how many times each photo is opened or downloaded, per day.
|
||||
Only the count is stored, on my own server in Sweden. No cookies, no IP address, no browser details and nothing
|
||||
that could identify you. This happens without consent because nothing about you is collected.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="space-y-3">
|
||||
<h2 class="text-2xl font-bold text-white">Photo backup app (Google)</h2>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user