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

Function track

apps/api/e2e/lib.ts:94–109  ·  view source on GitHub ↗
(body: unknown, ip: string)

Source from the content-addressed store, hash-verified

92export type TrackResponse = { deviceId: string; sessionId: string };
93
94export async function track(body: unknown, ip: string): Promise<TrackResponse> {
95 const res = await fetch(`${API_URL}/track`, {
96 method: 'POST',
97 headers: {
98 'content-type': 'application/json',
99 'openpanel-client-id': CLIENT_ID,
100 'user-agent': UA,
101 'x-client-ip': ip,
102 },
103 body: JSON.stringify(body),
104 });
105 if (!res.ok) {
106 throw new Error(`POST /track ${res.status}: ${await res.text()}`);
107 }
108 return (await res.json()) as TrackResponse;
109}
110
111export const screenView = (
112 ip: string,

Callers 7

sendSessionEventFunction · 0.90
scenarioReplayFunction · 0.90
scenarioIdentifyFunction · 0.90
screenViewFunction · 0.70
handleMouseEnterFunction · 0.50
handleScrollFunction · 0.50

Calls 2

fetchFunction · 0.50
stringifyMethod · 0.45

Tested by

no test coverage detected