So my problem is this (different from discussed here: In mobile advertising, I will get impression trackers, which could be 2, 3 or 4. Since the network bandwidth is limited, I would want to fire all the available trackers simultaneously, and not in a waterfall manner (please don't ask me why).
There is this code which we have been using:
<script type="text/javascript">
var imp_1 = document.createElement("img");
imp_1.src = "tracker url 1 here";
var imp_2 = document.createElement("img");
imp_2.src = "tracker url 2 here";
var imp_3 = document.createElement("img");
imp_3.src = "tracker url 3 here";
var imp_4 = document.createElement("img");
imp_4.src = "tracker url 4 here";
</script>
UPDATE All of these 1x1 impression trackers will be pointing to different servers, as they would be from different attribution partners.
My questions are:
Is it always required to add the above create call for adding
img
variables to the DOM? Is it a good practice do so in all scenarios?Would
document.body.appendChild()
always do the trick?If I instead used
new Image()
in place of thedocument.createElement()
would that work differently here? I was working on putting asetTimeout()
against each of the trackers, to fire them simultaneously, but wouldnew Image()
would be able to do that by itself?