Answer the question
In order to leave comments, you need to log in
Unwanted google ads appear on wordpress site. How to get rid?
Hello.
Recently, banners with ads have started popping up on the site - both on desktop and mobile, with the adblock turned off.
I noticed that right before the block, which is an advertisement, a script appears in the code:
fr_30_0.onresize = function() {
frm = top.document.getElementById('div-mb-native-0-97').getElementsByTagName('iframe');
frmh = frm[1].height;
frm[1].style.removeProperty('height');
frm[1].style.setProperty('height', frmh + 'px', 'important');
frmh = frm[1].width;
frm[1].style.removeProperty('width');
frm[1].style.setProperty('width', frmh + 'px', 'important');
};
googletag.cmd.push(function() {
googletag.display('div-mb-native-0-97');
});
googletag.cmd.push(function() {
googletag.pubads().addEventListener('slotRenderEnded', function(event) {
var x = document.getElementById(event.slot.getSlotElementId());
if (event.isEmpty && x) {
x.style.display = 'none';
}
if (!event.isEmpty && x) {
var advText = x.parentElement.previousSibling;
advText.parentNode.removeChild(advText);
}
});
});
<div id="div-mb-native-0-97" style="" data-google-query-id="CImv57Ss6esCFZKBmgodc3YHQg">
<div id="google_ads_iframe_/145047668/RT/Native_0__container__" style="border: 0pt none;">
<iframe id="google_ads_iframe_/145047668/RT/Native_0" title="3rd party ad content" name="google_ads_iframe_/145047668/RT/Native_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" srcdoc="" data-google-container-id="1" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question