Statistik backend and favicon

This commit is contained in:
2025-09-04 17:27:45 +02:00
parent eb1d713942
commit 1f82c98646
12 changed files with 361 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
// Page tracking functionality
function trackPageView(pageName) {
// Get user information
const userAgent = navigator.userAgent;
const referer = document.referrer || '';
// Send tracking data to server
fetch('/api/track-page-view', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
page: pageName,
userAgent: userAgent,
ipAddress: null, // Will be determined by server
referer: referer
})
}).catch(error => {
console.log('Page tracking failed:', error);
// Silently fail - don't interrupt user experience
});
}
// Auto-track page on load - only track main page visits
document.addEventListener('DOMContentLoaded', function() {
// Only track the main page (index.html or root path)
const path = window.location.pathname;
if (path === '/' || path === '/index.html') {
trackPageView('main_page_visit');
}
});