Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
¿Cómo detectar un error en googletag.cmd.push(function() { googletag.display('div-id'); });?

Estoy tratando de atrapar el error en
 googletag.cmd.push(function() { googletag.display('div-id'); });

Si bien sé que la raíz del problema es que la ranura no está definida en el encabezado, ¿cómo puedo detectar el error? Me enfrento a un problema en el que la ranura definida está desordenada y por todas partes, por lo que creo que detectar el error en googletag.cmd.push sería una solución más fácil.
Gracias.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

puede verificar si la ID de destino en las ranuras definidas por googletag existe en el DOM antes de mostrarla:

 //get all the defined slots var definedSlots = googletag.pubads().getSlots(); //loop through the definedSlots for (var x = 0; x < definedSlots.length; x++) { //retrieve the targeted ID var slotId = definedSlots[x].getSlotId().getDomId(); //if it exists if (document.querySelector('#'+ slotId)) { //then dislay it googletag.cmd.push(function() { googletag.display(slotId); }); } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!