I am trying to catch the error on
googletag.cmd.push(function() { googletag.display('div-id'); });
While I know the root of the problem is because the slot is not defined in the head, how can I catch the error? I'm facing a problem where the definedSlot is messy and all over the place so I think catching the error in the googletag.cmd.push would be an easier solution.
Thank you.
you can check wether the targeted ID in the googletag defined slots exists in the DOM before displaying it :