google-adsense icon indicating copy to clipboard operation
google-adsense copied to clipboard

TagError: adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.

Open zetaxXx2 opened this issue 2 years ago • 21 comments

Dear Support Team,

I am writing to you because I am experiencing an issue with the @nuxtjs/google-adsense library that I am using on my website. Specifically, I am seeing the following error message in my console:

TagError: adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.

I believe this error is related to the adsbygoogle tags that I am using in my HTML code to display ads on my site. However, I am unsure how to resolve this issue.

i want to load multi tags in one page, and I believe there is a way to make it right.

Could you please provide any additional guidance on how to troubleshoot this issue? I would greatly appreciate any assistance you can provide.

Thank you for your time and attention to this matter.

Best regards,

Yazan Alhaffar

zetaxXx2 avatar May 09 '23 11:05 zetaxXx2

I have the same error.

ivan-mihalic avatar May 21 '23 08:05 ivan-mihalic

hope we get fix for it

cuz what i see there is no response from them

yznetaX avatar May 21 '23 09:05 yznetaX

also same error

MrTob avatar Sep 07 '23 11:09 MrTob

This is still very much the case. Has anyone figured out the reason it happens?

charbs-io avatar Sep 16 '23 14:09 charbs-io

We are using this module and don't have this error. Must be a config issue?

kylegl avatar Sep 22 '23 15:09 kylegl

Same error.

thomasbnt avatar Oct 04 '23 00:10 thomasbnt

same error here too.

strid3r21 avatar Nov 08 '23 04:11 strid3r21

Same error

MatthewLeeCode avatar Nov 15 '23 09:11 MatthewLeeCode

I had Adsbygoogle accidentally nested within a ClientOnly tag, when i moved it out the error was resolved.

merri-ment avatar Dec 14 '23 22:12 merri-ment

Same error. Is there any solution?

JasonXDDD avatar Mar 12 '24 07:03 JasonXDDD

Do you have an adblocker on by chance?

kylegl avatar Mar 12 '24 11:03 kylegl

Do you have an adblocker on by chance?

No, I'm still in dev mode and don't have adblock enabled

JasonXDDD avatar Mar 13 '24 02:03 JasonXDDD

can you share a reproduction without your adsense acct creds?

kylegl avatar Mar 13 '24 07:03 kylegl

@kylegl I think it's coming from the querySelector looking only for class adsbygoogle. I've done a pull request #192 Adsense adds <ins class="adsbygoogle adsbygoogle-noablate" style="display: none !important;" data-adsbygoogle-status="done" data-ad-status="unfilled"><div id="aswift_0_host" style="border: medium; height: 0px; width: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; background-color: transparent; display: inline-block;" tabindex="0" title="Advertisement" aria-label="Advertisement"><iframe ...></iframe></div></ins> which will call adsbygoogle.push() because it has the class adsbygoogle although it's not an ads placeholder

jbmolle avatar Mar 13 '24 08:03 jbmolle

can you share a reproduction without your adsense acct creds?

I just install with yarn and add modules in nuxt.config. yarn add @nuxtjs/google-adsense

export default defineNuxtConfig({
  ...,
  modules: [
    ...,
    '@nuxtjs/google-adsense'
  ],

  googleAdsense: {
    id: 'ca-pub-XXXXXXX',
    test: true
  }
})

When I run yarn dev, it shows this error.

adsbygoogle.js?client=ca-google:221 Uncaught TagError: adsbygoogle.push() error: All 'ins' elements in the DOM with class=adsbygoogle already have ads in them.

JasonXDDD avatar Mar 14 '24 06:03 JasonXDDD

I think @jbmolle found the issue. If i understand it correctly, if you have no ads on the page, the script still tries to push an ad.

kylegl avatar Mar 19 '24 08:03 kylegl

The problem is solved

If you just configure it as shown below,

export default defineNuxtConfig({
  ...,
  modules: [
    ...,
    '@nuxtjs/google-adsense'
  ],

  googleAdsense: {
    id: 'ca-pub-XXXXXXX',
    test: true
  }
})

but do not insert the component <Adsbygoogle /> into the page, you will get the above error message.

leosin avatar May 16 '24 03:05 leosin

Same error. How can I fix that?

ernbaltaci avatar Jul 29 '24 17:07 ernbaltaci