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

fix: do not select ins element inserted by Google and raising a adsbygoogle.push() error

Open jbmolle opened this issue 1 year ago • 4 comments

It seems that Adsense script automatically insert an invisible ins element at the bottom of the page

<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>

So if we don't put any ads component on a page, the current onload script will find this ins (with className 'adsbygoogle') and try to call adsbygoogle.push with raises the error "All ins elements in the DOM with class=adsbygoogle already have ads in them." I think this pull request fixes #156 and maybe #179 Also it works only when onPageLoad option is set to true.

jbmolle avatar Mar 07 '24 11:03 jbmolle

Please approve this change. I don't understand why is still pending. It's pretty urgent. This google-adsense module is completely obsolete right now. Close this project if you don't update it.

valere-hope avatar Oct 03 '24 05:10 valere-hope

@valere-hope Nobody stops you from patching this change until it is merged. I will do so as soon as I have time for it to revisit the PR.

TheAlexLichter avatar Oct 03 '24 09:10 TheAlexLichter

Ok, thank you. Sorry for my harshness but I lost a lot of time trying to solve issues with this module. It is promoted on nuxt3 official website but it is outdated. I also understand the fact that you have little time available since 7 months have passed since the request. So i'll try to find another solution. Thank you.

valere-hope avatar Oct 03 '24 16:10 valere-hope

Ok, thank you. Sorry for my harshness but I lost a lot of time trying to solve issues with this module. It is promoted on nuxt3 official website but it is outdated. I also understand the fact that you have little time available since 7 months have passed since the request. So i'll try to find another solution. Thank you.

I'll get it done by the end of the week 👍

TheAlexLichter avatar Oct 03 '24 18:10 TheAlexLichter