Title: Problems with Header Script
Last modified: February 13, 2022

---

# Problems with Header Script

 *  Resolved [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/)
 * Since the last optimization, one of the Plug ins that we use in the page is no
   longer compatible with AMP.
 * This is Head, Footer and Post Injections. However I can’t remove it because I
   do use it for my regular non amp page. Here we have our Adsense and Analytics
   Code.
 * This issue is affecting our income as Adsense ads not always desplay and I don’t
   see the page count in our analyticis.
 * Did some could work this out?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproblems-with-header-script%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 15 total)

 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15363120)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * Thanks for contacting us, I was analyzing your website, I saw that you have Site
   Kit installed, in this case, you don’t need to inject the analytics code with
   the head and footer injections plugin, the Site kit plugin will take care of 
   it.
 * About the ads, header, footer injections post has an option to add AMP-compatible
   code, could you share how you are adding the ads code for amp pages ?
 * ![](https://i0.wp.com/i.imgur.com/odtBxFg.png?ssl=1)
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15365640)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/) ,
 * Thanks for your response. I am trying to paste how we have the codes in the AMP
   section, but I am not able to do that. I would not like to upload it in a third
   party app just to get a link.
 * In the Head Section we have the first part of the text. And then in the section
   Just after the body.
 * If there’s another way to show the screenshot let me know.
 * Thanks,
 * BF
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15365646)
 * Please find a link to the screenshot.
 * `https://zorroxmundo.com/wp-content/uploads/2022/02/AMP-Code.jpg`
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15366985)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * I saw your screenshot. I think the first script tag is not needed to amp version:
 * ![](https://i0.wp.com/zorroxmundo.com/wp-content/uploads/2022/02/AMP-Code.jpg?
   ssl=1)
 * Based on the ads documentation you just need to second tag:
 * ![](https://i0.wp.com/i.imgur.com/L67ayVF.png?ssl=1)
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15368070)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/),
 * We have it because this are Adsense instructions for AMP:
    Paso 1: Copie y pegue
   la secuencia de comandos entre las etiquetas <head> y </head> de su sitio web
 * Inserte este código una sola vez entre las etiquetas head del código HTML de 
   su sitio AMP. Esta secuencia de comandos cargará las bibliotecas de amp-auto-
   ads pertinente
 * Paso 2: Copie y pegue el código de los anuncios automáticos AMP justo después
   de la etiqueta <body> en las páginas de su sitio web
 * Copie y pegue este código justo después de la etiqueta <body> de las páginas 
   de su sitio web en las que quiera mostrar anuncios. La colocación del código 
   no refleja la posición del anuncio.
 * It’s in Spanish because the system is configured in that way.
 * Thanks,
 * BF
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15368255)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * No problem, I do understand Spanish; for example, the code for “Paso 1” is the
   two script tags from your screenshot or just one like mine?
 * For AMP up just need to get the code for AMP, available on the button “AMP is
   on”:
 * ![](https://i0.wp.com/i.imgur.com/fs1OJ46.png?ssl=1)
 * Because using AMP is only allowed to load script tags for AMP components, and
   the tag that you are using at the beginner looks like a tag for the non-AMP version
   when you click on “get code.”
 * like the print below:
 * ![](https://i0.wp.com/i.imgur.com/iqbK5Qd.png?ssl=1)
    -  This reply was modified 4 years, 3 months ago by [Fellyph Cintra](https://wordpress.org/support/users/fellyph/).
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15368702)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * I didn’t use the plugin “Head, Footer and Post Injections”, if you can try just
   add the body content and remove the script tags because depends on how the plugin
   injects the content. The AMP plugin can identify is and add the scripts needed.
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15372934)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/),
 * I erased the information from the Plug In and I don’t get any more ads.
 * Will continue to make some trials. According to your last message I just need
   to leave the after body code. Is it right?
 * Thanks once again,
 * BF
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15373151)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * The expected behavior is the AMP plugin injects the script tag when you include
   the amp-auto-ads tag on the body with your id; I have tested the AMP pages, and
   the ads are being displayed for me:
 * ![](https://i0.wp.com/i.imgur.com/uWASrDj.png?ssl=1)
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15381119)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/),
 * Thanks so much for checking. I still don’t see advertisment if I enter directly
   to an AMP page. If add the /amp at the end of a regular page I do get ads.
 * This is very strange. Also, the plug in is not making any compatibility issue
   with AMP anymore. However, ADSENSE ads are not appearing.
 * Appreciate your support,
 * BF
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15392887)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/),
 * Not sure what’s going up, but still no reliability with the ADS.
 * I tried searching inside the Inspect function, and won’t see any “ads?” when 
   pulling data directly from an AMP page. If I transform a regular page to AMP 
   by changing the address, I do see Ads.
 * [https://www.google.com/amp/s/zorroxmundo.com/para-disfrutar-brasil-consideraciones-antes-de-visitar/amp/](https://www.google.com/amp/s/zorroxmundo.com/para-disfrutar-brasil-consideraciones-antes-de-visitar/amp/)
 * Still unsure what’s going on.
 * Thanks,
 * BF
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15395720)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * I’ve checked the website and ads are appearing, in both AMP and canonical URLs:
   [https://recordit.co/1AqePw77Qn](https://recordit.co/1AqePw77Qn)
 * The ads code has already been placed via Site Kit, so there is no action required.
   If they’re looking to increase ad performance they may consider switching to 
   transitional or standard mode, so they can compare performance better between
   AMP and non-AMP. Reader mode doesn’t include the full themes layout, sidebars,
   and widgets. A better experience, for users and for ad performance could be to
   migrate from legacy reader mode.
    -  This reply was modified 4 years, 3 months ago by [Fellyph Cintra](https://wordpress.org/support/users/fellyph/).
 *  Thread Starter [brunofuchs](https://wordpress.org/support/users/brunofuchs/)
 * (@brunofuchs)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15409479)
 * Hi [@fellyph](https://wordpress.org/support/users/fellyph/),
 * Thanks so much for helping. I think I understand the situation more, it still
   an situation to solve.
 * When one access directly the AMP page with only the AMP at the end. Advertisments
   appear (sometimes even a lot, but I can check that later).
 * [https://zorroxmundo.com/roma-la-dolce-vita-en-la-ciudad-eterna/amp/](https://zorroxmundo.com/roma-la-dolce-vita-en-la-ciudad-eterna/amp/)
 * However, when searching for the address directly from google, I see that the 
   page address totally changes:
 * [https://www.google.com/amp/s/zorroxmundo.com/roma-la-dolce-vita-en-la-ciudad-eterna/amp/](https://www.google.com/amp/s/zorroxmundo.com/roma-la-dolce-vita-en-la-ciudad-eterna/amp/)
 * I’m not sure why I get the /amp/s before… but it is when ads don’t appear. Is
   there a way to incude also Adsense in the new form? or to avoid geeting the address
   with google.com/amp/s?
 * Thanks so much,
 * BF
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15416187)
 * Hi [@brunofuchs](https://wordpress.org/support/users/brunofuchs/),
 * The cached content comes from the origin domain, so if there are ads or ad code
   on the origin domain, then the AMP cache version will be the same. AMP Cache 
   URLs don’t need to be approved in AdSense, ads are eligible to be served as it’s
   tied to the origin domain.
 * What can happen the AMP-cache version can stores a version from one week ago 
   where the ads weren’t set right. I will check again this week to see if the ads
   appear again.
 *  [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * (@fellyph)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15460792)
 * As we didn’t receive a response I’ll mark this as resolved. Feel free to open
   a [new support topic](https://wordpress.org/support/plugin/amp/#new-post) if 
   you require any further assistance.

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Problems with Header Script’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [compatibility](https://wordpress.org/support/topic-tag/compatibility/)
 * [header](https://wordpress.org/support/topic-tag/header/)

 * 15 replies
 * 2 participants
 * Last reply from: [Fellyph Cintra](https://wordpress.org/support/users/fellyph/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/problems-with-header-script/#post-15460792)
 * Status: resolved