• Resolved Nitin Jain

    (@glamsham)


    Hi,

    I have been struggling to find how / where to add / insert the google adsense auto ads header footer codes. I couldn’t find a place in the AMP plugin. Kindly guide.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @glamsham

    Thank you for contacting us, As you mentioned in the previous support topic you are using the Newspaper theme by tagDiv, You can try adding auto-ads code in header using wp_head hook.

    eg:

    add_action( 'wp_head', function() {
            ?>
    <amp-auto-ads type="adsense" data-ad-client="ca-pub-xxxxxxxxxxxxxxx">
    </amp-auto-ads>        
    <?php
    } );

    You also use the Sitekit by Google plugin which integrates all goole services including auto ads in your AMP and non-AMP pages.

    You can also try using this mini-plugin (to install follow the instructions in the comments)

    We hope this helps!

    Thread Starter Nitin Jain

    (@glamsham)

    Hi,

    This is confusing me as the link indicates that the code is to be implemented in the body!

    Plugin Support Milind More

    (@milindmore22)

    Hello @glamsham

    Sorry about confusion, Please try using it on wp_body_open or amp_post_template_body_open and see if that works for you

    add_action( 'wp_body_open', function() {
            ?>
    <amp-auto-ads type="adsense" data-ad-client="ca-pub-xxxxxxxxxxxxxxx">
    </amp-auto-ads>        
    <?php
    } );
    Plugin Support Milind More

    (@milindmore22)

    @glamsham 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 4 replies - 1 through 4 (of 4 total)
  • The topic ‘header footer code’ is closed to new replies.