introduced supabase and experiment management UI (#23)

* introduced supabase and experiment management UI

* fixing cookie import
This commit is contained in:
Daniel Alves Rösel
2025-11-18 20:45:11 +01:00
committed by GitHub
parent ab8b8787a8
commit 894ce87a5d
18 changed files with 977 additions and 176 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'react';
import '@/lib/experiments' // ensure experiments lib is loaded
import '@/lib/experiments'
import type { EventName } from '@/lib/events';
const fetchSessionId = async (): Promise<string> => {
@@ -21,10 +21,14 @@ const track = async (ev: {
metadata?: Record<string, unknown>;
}) => {
try {
const experimentId = localStorage.getItem('phantom_experiment_id');
await fetch('/api/ingest', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(ev),
body: JSON.stringify({
...ev,
experimentId: experimentId || undefined,
}),
});
} catch (err) {
console.error('track failed:', err);