deploy
Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Failing after 1m32s

This commit is contained in:
2026-01-26 02:19:48 +01:00
parent ac1e22017e
commit 574d5a8a9a
6 changed files with 293 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import type { AnalyticsEventProperties, AnalyticsService } from './analytics-service';
import { getServerAppServices } from '../create-services.server';
/**
* Type definition for the Umami global object.
@@ -79,11 +80,16 @@ export class UmamiAnalyticsService implements AnalyticsService {
if (!websiteId) return;
const logger = getServerAppServices().logger.child({ component: 'analytics' });
logger.info('Sending analytics event', { eventName, props });
fetch(`${umamiUrl}/api/send`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'User-Agent': 'KLZ-Server' },
body: JSON.stringify({ type: 'event', payload: { website: websiteId, name: eventName, data: props } }),
}).catch(() => {});
}).catch((error) => {
logger.error('Failed to send analytics event', { eventName, props, error });
});
return;
}
@@ -121,11 +127,16 @@ export class UmamiAnalyticsService implements AnalyticsService {
if (!websiteId || !url) return;
const logger = getServerAppServices().logger.child({ component: 'analytics' });
logger.info('Sending analytics pageview', { url });
fetch(`${umamiUrl}/api/send`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'User-Agent': 'KLZ-Server' },
body: JSON.stringify({ type: 'event', payload: { website: websiteId, url } }),
}).catch(() => {});
}).catch((error) => {
logger.error('Failed to send analytics pageview', { url, error });
});
return;
}