• Resolved curchunflo

    (@curchunflo)


    Hello how are you? I have a query: the AMP version of my site is not showing ads that the non-amp version is showing.
    I am inserting the ads from google ad manager vía functions.php, but the amp plugin reports that the code has been invalidated, I don’t understand why, since it is the same code that google gives me.
    Could you help me?
    What I have to do is define the head slots and load the rest of the code, it works perfect in the non-amp version but the script suppresses the code in the amp version.
    Here is an example from the plugin console:

    Error code
    DISALLOWED_TAG
    Invalid markup
    <script … >
    Element attributes
    async	
    src	//www.googletagservices.com/tag/js/gpt.js
    Element name
    script
    Parent element
    head

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for reaching out. For AMP URLs you need to insert AMP valid Google Tag Manager code along with amp-ads code as opposed to traditional JavaScript based ad code.

    In order to perform both have you tried using the Site Kit plugin? Before doing so you can removed any manually inserted AdSense and Tag Manager code, while then allowing Site Kit to insert both onto your site.

    If you prefer to not use the Site Kit plugin you’ll need to use a conditional statement if continuing to use AMP in transitional mode. You’ll need to insert traditional ad code and the standard Tag Manager container code for your canonical (non AMP) URLS and AMP compatible Tag Manager and amp-ads code for AMP URLs. You can use this mini plugin is using the default WordPress editor, or the below conditional statements for theme editing.

    <?php if ( function_exists( 'amp_is_request' ) && amp_is_request() ) : ?>
      //AMP URL snippets below
      <amp-ad>...</amp-ad>
    <?php else : ?>
      //Canonical URL snippets below
        <script>...</script>
    <?php endif; ?>

    Let me know if you need any further assistance with the above.

    As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google Ad Manager DISALLOWED_TAG’ is closed to new replies.