You could replace the 'INSERT_CACHEBUSTER' with a timestamp, like this:
var img = document.querySelector('img[src*="INSERT_CACHEBUSTER"]')
img.src = img.src.replace('INSERT_CACHEBUSTER', (new Date()).getTime())
Timestamp works better than a random number because it increments every millisecond, so there's virtually no way for it to repeat which would the case with a random number, but if you really want random:
img.src = img.src.replace('INSERT_CACHEBUSTER', Math.random())
EDIT: both solutions make it possible to hit the tracking server twice: once with the placeholder string then once again after the src
is modfied. You can avoid it by either using another attribute, for example data-src
:
// HTML
<img data-src='http://blahblah&rand=INSERT_CACHEBUSTER' width='1' height='1' border='0'>
// JS
var img = document.querySelector('img[data-src*="INSERT_CACHEBUSTER"]')
img.src = img.getAttribute('data-src').replace('INSERT_CACHEBUSTER', (new Date()).getTime());
or generating the tracking image in pure JS
var img = new Image();
img.width = 1;
img.height = 1;
img.src = 'http://h.nexac.com/e/a-858/s-1486/c-705/g-2423.xgi?pkey=xbue89gtzpg16&chpcm=&chpsg=&chpcr=&chpck=&rand=' + (new Date()).getTime() +'&chpth=';
document.body.appendChild(img);