MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / trackit

Function trackit

apps/api/scripts/mock.ts:73–90  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

71}
72
73async function trackit(event: Event) {
74 console.log('trackit', JSON.stringify(event.track, null, 2));
75 const res = await fetch('http://localhost:3333/track', {
76 method: 'POST',
77 headers: {
78 'Content-Type': 'application/json',
79 ...event.headers,
80 },
81 body: JSON.stringify(event.track),
82 });
83
84 if (res.ok) {
85 return true;
86 }
87
88 console.error('Failed to track event', res.status, res.statusText);
89 return false;
90}
91
92function generateScreenViews({
93 domain,

Callers 2

triggerEventsFunction · 0.85
simultaneousRequestsFunction · 0.85

Calls 4

fetchFunction · 0.50
logMethod · 0.45
stringifyMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected