Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

Google ad manager - To check unit ID presence

0 votes
54 views
added May 22 in Google tools by lcjr Second Warrant Officer (3,160 points)
// Google ads DOM commonly shows this
// <div id="div-gpt-ad-1554101456137-0" data-google-query-id="CO6djYjpxukCFWbocwEdA58FJg" style="display: none;">
// The trick to check the unit; when div id has css style of display: none and the existence HTML attribute of 'data-google-query-id'

$.fn.hasAttr = function(name) {  
    return this.attr(name) !== undefined;
  };

  if(($(dfpStoFullId).css('display') == 'none') || !$(dfpStoFullId).hasAttr('data-google-query-id')){ 
    HideSto();  
    $(stoEl).hide();
    console.log('sto display none');
  }

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...