Closed
Description
The current implementation does not specify a fetch priority when the Segment API sends data to the server. Consequently, the browser defaults to selecting the priority, which in several web applications, tends to be 'high'.
Desired Behavior: We aim to assign a low priority to analytics network calls. This adjustment will allow the browser to prioritize other critical resources more effectively.
However, at present, there is no mechanism available to customize the fetch priority.
fetch(url, {
keepalive: config?.keepalive,
headers: { 'Content-Type': 'text/plain' },
method: 'post',
body: JSON.stringify(body),
// priority attribute is not sent currently, Defaults to auto, when not set
})
Reference: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#priority