• Resolved roxer82

    (@roxer82)


    Hello,
    I need to add a script in head for Google ads:
    <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
    I’d like to do it without a plugin, because I’m customizing a new design and I don’t want it to interfere with the actual one, so, I should add it from function.php or something like that.
    Thanks.

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

    (@milindmore22)

    Hello @roxer82

    Thank you for the support topic, You don’t need to add the script while using the AMP plugin, the AMP plugin will find out the AMP component being used & include the script required for it.

    eg: if you use <amp-ad> component the plugin will enqueue the script required for it, you don’t need to include it specifically again.

    I hope this helps!

    Thread Starter roxer82

    (@roxer82)

    Hi Milind, thanks for your answer.
    You mean if I add it in head of my regular theme it will appear in the amp version? I’m using “Reader theme: AMP Legacy” for my AMP version.

    Plugin Support Milind More

    (@milindmore22)

    Hello @roxer82

    yes, I mean if you use a component in your theme which can be used as Transitional Mode or in Standard mode.

    To add it in AMP Legacy theme (which is a different theme than your Regular theme)
    You will have to use amp_post_template_head action hook.

    In all three cases, you are not required to add the script manually. you just need to add the tag <amp-ad> in you page (it can be in head,body or footer) and the script will be included for the same by the AMP plugin.

    I will recommend checking out our Guide for modifying Legacy Theme.

    @roxer82 As we haven’t received a response, I’ll mark this as resolved. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add script in head’ is closed to new replies.