samedi 2 mai 2020

random number between 1000 & 2000 for time of day

I'm looking to generate a random number between 1000 & 2000 for the time of day, it has to be in 100 increments. It's so I can test prebid timeouts and see different viewability figures and cpm's. Then once I get enough data, I can work out the best settings for any given time of day and hopefully get better results.

help would be much appreciated.

This is what i have so far but i'm changing them by hand depending on the time of day I see peaks and troughs in traffic at the moment:

var timeoutMap = {
0 : 2000,
1 : 2000,
2 : 2000,
3 : 1600,
4 : 1600,
5 : 1600,
6 : 1400,
7 : 1400,
8 : 1400,
9 : 1400,
10 : 1400,
11 : 1400,
12 : 1600,
13 : 1600,
14 : 1600,
15 : 1600,
16 : 1600,
17 : 1600,
18 : 1600,
19 : 1600,
20 : 1600,
21 : 1600,
22 : 1600,
23 : 2000
};
var t = new Date().getUTCHours();
PREBID_TIMEOUT = timeoutMap[t];
console.log("prebid timeout:", PREBID_TIMEOUT );



Aucun commentaire:

Enregistrer un commentaire