Creating a dynamic TIMEOUT based on connection/device/browser
Has anyone built in any functionality to dynamic change the TIMEOUT of the auction based connection speed, device or browser?
If so, would anyone be interest in sharing some results/code?
@mjwhaley We are currently investigating some possible ways to do this. Stay tuned...
I haven't implemented something like that but you can easily add checks with a library like https://github.com/matthewhudson/device.js
var PREBID_TIMEOUT = 700;
if (device.mobile()){
PREBID_TIMEOUT = 2000;
}
if (device.tablet()){
PREBID_TIMEOUT = 1500
}
Also haven't implemented this yet but my current plan is to use Date.now()-window.performance.timing.navigationStart as a basis for PREBID_TIMEOUT. This value will be low on fast devices with a fast connection, it will be high for mobile devices on a slow connection. This way the timeout will correspond to the speed with which the page is loading.
For example:
var PREBID_TIMEOUT = Math.min(Math.max((Date.now()-window.performance.timing.navigationStart)*7, 300), 4000);
This would limit the timeout to 4 seconds (for really slow devices) but would be something closer to 300ms on a fast device.
@mjwhaley does the solution @BartVB describes solve for your use case?
Closing this, please reopen if new info.
@BartVB have you tried out your solution on live sites? And if so, how well has it been performing?