Worth adding preconnect hints for cdn.croct.io and api.croct.io?
Doing a resource-hints pass on a client site. Lighthouse flags third-party origins without preconnect. Which hosts does the Croct SDK actually talk to, and does preconnecting them shave anything meaningful? Setup varies per client (some script tag, some npm, one fully server-side) so the answer probably depends on the mode
1 answer
It depends entirely on the mode, so here is the host map.
No-code script tag: the script loads from cdn.croct.io and API calls go to api.croct.io. Those are the two hosts in play, and preconnect helps most when the first fetch happens early in the page life, which is typical since the SDK starts talking as soon as it plugs. Worth adding both hints on those clients:
<link rel="preconnect" href="https://cdn.croct.io" /><link rel="preconnect" href="https://api.croct.io" />npm SDK: there is no CDN script at all, the code ships in your bundle, so only api.croct.io is relevant and only if the page fetches content or tracks from the client.
Fully server-side (fetchContent): the browser never talks to Croct. The server makes the calls, so there is nothing to preconnect and Lighthouse has nothing to flag. Skip the hints on that client.
One more configuration to know about: if a client uses first-party proxying via baseEndpointUrl and cidAssignerEndpointUrl, requests ride the existing connection to your own origin. No extra hints needed there either, and as a side effect that setup also neutralizes ad-blocker filtering of the SDK endpoints.