Google Search Console warns you that you can only have an amp-story derived tag in
as shown in the image.I sent the amp-story sitemap in Search Console and hours later this warning appeared that the content will not be indexed due to an amp-story tag error in
. There should be no such error.
_Do not alter or remove anything below. The following sections will be managed by moderators only._
Hi there
Running your story URL (https://nerdvision.com.br/stories/superman-the-movie-final-cut) through the AMP validator shows that there is 1 issue with AMP validation, which is the one that Search Console is reporting.
The issue is coming from this piece of code:
<noscript><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-5CKVTZX"
height=0 width=0 style=display:none;visibility:hidden></iframe></noscript>
This is not allowed for Web Stories, at least not in this form. For Web Stories, <amp-analytics> needs to be used, see https://support.google.com/tagmanager/answer/9205783?hl=en.
Are you using a particular plugin to insert Google Tag Manager on your site? Or did you implement this yourself?
Hi friend. Thanks for the reply.
I use the wp plugin called Head, Footer and Post Injections. where I put the GTM tag.
Thanks for your info!
In the plugins settings, please try something like this for now:
<?php if ( ! is_singular( 'web-story' ) ) : ?>
<noscript><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-5CKVTZX"
height=0 width=0 style=display:none;visibility:hidden></iframe></noscript>
<?php endif; ?>
Here's a screenshot of the settings page:

This will fix the error.
However, it means the GTM tag won't be printed for individual Web Stories.
To achieve that, you'd need to follow the instructions at https://support.google.com/tagmanager/answer/9205783?hl=en for creating an AMP container etc.
However, I would recommend you to use a plugin like Site Kit by Google to handle this automatically for you. Then it will work automatically and you don't even need the Head, Footer and Post Injections plugin for this.

Thank you for your help.
I did exactly as shown in your code, check the image, I deleted the WP cache and tested again on the AMP validator and the error continues.
Did I do something wrong.
ps: I installed the Google Site kit as indicated.
https://validator.ampproject.org/#url=https%3A%2F%2Fnerdvision.com.br%2Fstories%2Fsuperman-the-movie-final-cut
You need to delete lines 1-4. The only thing you should have in this box is this:
<?php if ( ! is_singular( 'web-story' ) ) : ?>
<noscript><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-5CKVTZX"
height=0 width=0 style=display:none;visibility:hidden></iframe></noscript>
<?php endif; ?>
Nothing else.
Have you completed the Site Kit plugin's setup? If so, you should be able to deactivate the "Head, Footer and Post Injections" plugin and use GTM via Site Kit.
friend, thanks for the tips and your time.
I made the changes and now everything is ok!
thank you, you were very helpful.
Most helpful comment
friend, thanks for the tips and your time.
I made the changes and now everything is ok!
thank you, you were very helpful.