Support » Plugin: Site Kit by Google - Analytics, Search Console, AdSense, Speed » Only one AdSense head tag supported per page

  • Resolved TechGeek

    (@yogeshbeniwal)


    Multiple errors are displayed in Browser console for Adsense:
    – adsbygoogle.push() error: Only one ‘enable_page_level_ads’ allowed per page.
    – adsbygoogle.push() error: Only one AdSense head tag supported per page. The second tag is ignored.

    Site Health information is shared via Form.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Thanks for reaching out. This console warning is as a result of having more than one Auto Ads snippet place on your site. While Site Kit most likely in your case has inserted one snippet there may be another snippet added, either manually or via another plugin or theme feature.

    While no action is required (as one of the snippets is ignored) best practice would be to remove one of the snippets, which would remove the console warning. You can remove the Site Kit placed snippet if you wish, while keeping the active module active to view AdSense data for your site (Site Kit > Settings > Connected Services > AdSense > Edit).

    Alternatively you can remove the other snippet, not placed via Site Kit. If you need help with the above let me now. I’m also happy to help determine the source of the other snippet if you’d like to share your Site Health information here or using this form.

    Thread Starter TechGeek

    (@yogeshbeniwal)

    Thanks for the detailed response as always.

    Interested to find out from where additional auto ads snippet is added. Auto Ads are disabled on Adsense Console and is not supposed to be inserted. Ad inserter plugin is used to show ads manually.

    Preliminary check shows only one snippet added in HEAD Section. Site Health information is shared via form.

    • This reply was modified 1 month ago by TechGeek.
    • This reply was modified 1 month ago by TechGeek.
    Plugin Support James Osborne

    (@jamesosborne)

    No problem at all, happy to help! I checked your details from the Site Health information you kindly provided, along with checking your site and I can see two different Auto ads snippets (screenshot). One of these is in the head of your site, placed via Site Kit. I’m unsure how the other has been placed, it may be via your Ad Inserter configuration.

    Please check your Ad Inserter settings or remove the snippet placed via Site Kit before checking once more.

    Auto Ads are disabled on Adsense Console and is not supposed to be inserted. Ad inserter plugin is used to show ads manually.

    Disabling Auto ads at AdSense level will ensure there are no Auto ads placed on your site however if the code snippets remain on your site there can be console errors or warnings that appear.

    Let me know how you get on after removing one of the snippets. I can also check your site to ensure there is only one snippet present.

    Thread Starter TechGeek

    (@yogeshbeniwal)

    Second code is outside of HEAD section and is placed using Ad plugin as per How to modify your responsive ad code guide.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for sharing. The resource you shared if for placing single ad units, rather than Auto ads. If you’re looking to ensure the console warning you’re encountering doesn’t appear you’ll need to remove one of the Auto ads snippets.

    Let me know if you have any further queries on this.

    Thread Starter TechGeek

    (@yogeshbeniwal)

    Can help to identify second auto ad snippets then. The second code from screenshot shared above is for single ad unit

    Plugin Support James Osborne

    (@jamesosborne)

    No problem at all. In the screenshot when looking at the second image you’ll see a “enable_page_level_ads” reference. This indicates Auto ads is enabled within this ad unit – the non Site Kit placed unit.

    You’ll find more on this below:
    https://support.google.com/adsense/thread/20408523/why-is-my-site-keep-complaining-only-one-enable-page-level-ads-allowed-per-page?hl=en

    If you temporarily deactivate your Ad Inserter plugin I can check for the same console error once more.

    Thread Starter TechGeek

    (@yogeshbeniwal)

    Thanks. Below error is resolved by removing <script> tag from individual manual ad
    – adsbygoogle.push() error: Only one AdSense head tag supported per page. The second tag is ignored.

    However adsbygoogle.push() error: Only one ‘enable_page_level_ads’ allowed per page is still appearing.
    – Only one enable_page_level_ads search match in HTML source
    – enable_page_level_ads error goes away after disabling code insertion by sitekit, but then individual ads are not shown, because sitekit remove <script> tag too

    This may be because site kit insert new ad code but also insert https://github.com/google/site-kit-wp/blob/develop/includes/Modules/AdSense/Web_Tag.php#L68-L72

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update. While the product experts at the AdSense Help Center would have more insights when it comes to manually placed snippets I don’t think removing the <script> tags would be recommended.

    If you’re looking to remove any browser console errors on your site in relation to “enable_page_level_ads” then you’ll need to remove either the Site Kit placed snippet or the manually inserted snippet, not specifically the <script> tag from any manual or plugin inserted AdSense snippet.

    This may be because site kit insert new ad code but also insert https://github.com/google/site-kit-wp/blob/develop/includes/Modules/AdSense/Web_Tag.php#L68-L72

    This code snippet is to ensure that AdSense code is placed, using the enable_page_level_ads reference for Auto ads.

    So to summarize you’ll just need to ensure you only have one snippet placed if you want to remove those console warnings. Either the Site Kit placed snippet or the other AdSense snippet.

    Thread Starter TechGeek

    (@yogeshbeniwal)

    Able to resolve error with Code changes suggested in Pull Request

    Plugin Support James Osborne

    (@jamesosborne)

    Glad you were able to resolve it. Note that what that specific pull request wasn’t merged we did make changes to use the latest AdSense snippet recommendations as per the below GitHub issue:
    https://github.com/google/site-kit-wp/issues/3783

    The snippet placed by Site Kit does include the enable_page_level_ads reference (screenshot), including with this latest change – if you’ve allowed Site Kit to insert the snippet for you.

    Let us know if you have any further queries on this.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.