in src/lib/header-bidding/prebid/modules/analyticsAdapter.ts [222:260]
sendPayload: async (
url: string,
payload: AnalyticsPayload,
): Promise<void> => {
const events = [...queue];
queue = [];
try {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(payload),
keepalive: true,
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(
`Failed to send analytics payload: ${
response.statusText
} (${response.status})`,
);
}
logEvents(events);
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
// Ignore abort errors, they are expected when the fetch times out
return;
}
reportError(
error,
'commercial',
{},
{
events,
},
);
}
},