Closed mandeepsng closed 1 year ago
were you able to get adsense code working?
Hi Mandeep, this issue will get resolved by adding the script to the Head of _document.tsx file in pages folder.
Also, it is better to add ads.txt file with adsense credentials you get from Google Adsense in the public folder.
Hello! Can someone help me out with this, should I create a new _document.tsx in a new folder called pages and then add the script?
Is your feature request related to a problem? Please describe.
this is my adsense code
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-xxxxxxxxxxx" crossorigin="anonymous"></script>
need to add into headerHow can I do that I tried this but not working
<Script id="Adsense-id" async="true" onError={(e) => { console.error("Script failed to load", e);}} strategy="afterInteractive" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-xxxxxxxxxxxx" crossorigin="anonymous" />