Add possibility to set timeout

During integration of snowplow JS tracker we found out that with slow connection we got canceled status with error : net_error = -3 (ERR_ABORTED) for requests with > 5sec time.

I had load https://d1fc8wv8zag5ca.cloudfront.net/2.6.2/sp.js and change there timeout to 10seconds.
After this changes our requests got success status.

Question: is it possible to add new param to set timeout ?

For example:
window.snowplow(‘newTracker’, ‘cj’, ‘{TRACKER_PIXEL}', { appId: '{APP_ID}’,
cookieDomain: ‘${COOKIE_DOMAIN}’,
timeout: 10000
});

I’d be tempted to first debug why the requests are taking so long to get to the collector, e.g., is the DNS lookup taking too long or is the TTFB (time to first byte) longer than expected?

The request/response from a Snowplow collector should be able to comfortably make a roundtrip within 1 second so a request taking longer than that suggests something is amiss.

Hi! It’s easy reproduce with slow 3G connection in private mode. How I should implement in this case ? Do you have some special settings for it ?

Feel free to raise a ticket in the JavaScript Tracker repo @asamoilich and we can discuss:

Hi ! Created this one:

Thx

Thanks for submitting that @asamoilich!