Posthog logging test

This commit is contained in:
Milorad FIlipović 2025-11-19 12:12:13 +01:00
parent 0dca2b0f12
commit 983fa3c4ff
4 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,7 @@ export class PostHogController {
// Main event capture endpoint
@Post('/capture/', { skipAuth: true, rateLimit: { limit: 200, windowMs: 60_000 } })
async capture(req: AuthenticatedRequest, res: Response, next: NextFunction) {
console.log('==> Capture endpoint called');
return await this.proxy(req, res, next);
}
@ -51,6 +52,7 @@ export class PostHogController {
// Session recording events (alternative endpoint)
@Post('/e/', { skipAuth: true, rateLimit: { limit: 50, windowMs: 60_000 } })
async sessionEvents(req: AuthenticatedRequest, res: Response, next: NextFunction) {
console.log('==> Session events endpoint called', req.body);
return await this.proxy(req, res, next);
}

View File

@ -764,6 +764,9 @@ onMounted(() => {
nodeViewEventBus.on('deleteWorkflow', handleDeleteWorkflow);
nodeViewEventBus.on('renameWorkflow', onNameToggle);
nodeViewEventBus.on('addTag', onTagsEditEnable);
telemetry.track('Very special event', {
user_id: usersStore.currentUser?.id,
});
});
onBeforeUnmount(() => {

View File

@ -109,6 +109,7 @@ export class Telemetry {
},
});
console.log('[TELEMETRY] track:', event, updatedProperties);
usePostHog().capture(event, updatedProperties);
}

View File

@ -181,7 +181,10 @@ export const usePostHog = defineStore('posthog', () => {
const capture = (event: string, properties: IDataObject) => {
if (typeof window.posthog?.capture === 'function') {
console.log(`[POSTHOG STORE] Capture: ${event}`, properties);
window.posthog.capture(event, properties);
} else {
console.log(`[POSTHOG STORE] Capture skipped, PostHog not initialized: ${event}`, properties);
}
};