Google publisher tag showing coloured box randomly
I am trying to add googletags multiple times on the page. In some places on the page ads are displayed correctly and in some places, I see the box as shown in the attached screenshot.
Code sample:
const slot = googletag.defineSlot( options.addUnit, options.sizes, options.containerId, )?.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); // Disable initial load. googletag.pubads().disableInitialLoad(); // Start ad fetching googletag.enableServices(); googletag.pubads().refresh([slot]);
The above code is called multiple times with some different slot level targeting parameters like 'pos'.
In total, I am calling it 8 times on the page and 4 times div elements are injected dynamically in the page. Sometimes I see one generic box sometimes two or at times 3, this behavior is random. See the second screenshot after I refresh the page.