Recently Google introduced different types of ad formats for AdSense publishers. However, you need to use Auto Ads setup to get benefitted from most these new ad formats. The best option for publishers is to combine the power of auto ads and manual placement to make more revenue from the content. When doing so, you may see errors in the browser’s developer console indicating the problems in the setup. Only one AdSense head tag supported per page, the seconds tag is ignored is one such error message you will frequently see. In this article, we will explain how to fix that error simply by using proper ad code.
Google Auto Ads Setup
Before proceeding further, it is necessary to understand the Auto Ads setup in Google AdSense. Earlier days, it was called Page-Level ads and you need to insert a piece of script in the header section of the page. Google will use the script on the page header and show automatic advertisements with their AI technology. This worked independently of other display ad codes on the same page.
However, Google changed this setup with Auto Ads and removed the need of using separate ad code. Now that if a page contains any standard ad code for display, inline, in-feed or matched content ad code, Google will automatically show auto ads. The only thing is that you need to simply enable Auto Ads in your AdSense account.
If you do not want to use manual placements, then inserting Auto Ads code in the header is sufficient.
Auto Ads and Other Ad Code
Below is an example ad code for auto ads.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"></script>
Below is an example ad code for normal display ad in AdSense.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"></script>
<!-- Ad Name -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="1234567890"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
As you can see the first script section is common for both auto ads and normal ad code. When using both auto ads and display ads on the same page, you have to use this script only one time. Otherwise, you will see an error indicating only one head tag is supported and the second tag is ignored. Similarly, when you manually insert multiple ad codes on the same page, you need to make sure the adsbygoogle.js script is used only one time.
Viewing AdSense Errors
You will not see any errors in browser’s frontend or in your AdSense account when placing multiple ads on your pages. However, you can view errors in browser’s developer console mentioning only one AdSense head tag supported and the second tag is ignored.
- Option your webpage where you have multiple ad codes.
- Right click and select “Inspect” or “Inspect Element” option to open browser’s developer console.
- You will number of errors and click on it to open the error list which is shown under “Console” tab.
- For example, if you see there are 6 same errors, then you are using the ad code 6 times with the redundant adsbygoogle.js script.
Fixing Only One AdSense Head Tag Supported Error
As the root cause of the problem is clear, it is easy to fix the issue.
- No matter whether you want to use auto ads or not, place the first line of script inside the header section of your website.
- If you want to enable auto ads, simply turn it on in your AdSense account, otherwise disable it.
- For manual ad code insertion, ignore the first script line and insert the remaining part wherever you want. The manual ad code without the first script will look like below:
<!-- Ad Name -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1234567890123456"
data-ad-slot="1234567890"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
- Publish your site and check the browser console will not have any errors related to AdSense head tag.
- If you already have multiple ad code insertion on your pages, you have to manually remove the first script line from each insertion to fix the error.
In summary, make sure to have only one adsbygoogle.js script is available on your page. The best option is to inert this code in the header and use the remaining part of the ad unit code wherever you want. As mentioned, you can enable or disable Auto Ads in your account setup.
Why Should You Fix the Issue?
We do not think using multiple script will impact your ad revenue as it will not affect the ad serving. However, AdSense scripts will plummet the page speed as they need to load from Google and other third-party servers. Therefore, it is a good idea to reduce number of HTTP requests by removing unnecessary scripts. In addition, you can also fix the browser console errors by removing the script.
When removing the script, make sure to use the remaining part of ad code in correct manner. You can also check the ads are displayed without problem and there are no other browser console errors.
3 Comments
Leave your reply.