I am using the Google Analytics module. The normal Google Analytics script is appearing on AMP pages. This is independent of the AMP version of Google Analytics, which only appears when it's supposed to.
The Google Analytics module provides a way to exclude some paths for its script, but there is no way to exclude a path by a query string, only by normal paths, so there doesn't seem to be any way to use that to keep the non-AMP analytics off the page.
More details of the two techniques can be found at #2731279: Add google_analytics hook to skip default GA integration for AMP pages
Comments
Comment #2
playful commentedI was able to resolve the second error by replacing 'responsive' with layout="responsive" in block--amp-system-branding-block.html.twig.
Comment #3
paultgreen commentedI'm also experiencing the issue with the Google Analytics module. When I disable the analytics module, my site returns as valid AMP on the Google validator, but when I re-enable it I get the error about custom scripts not being allowed.
Did you find a solution in the end?
Comment #4
playful commentedI was only able to get it to work with Google Analytics by using the AMP 8.2 version. Please update here if the 8.3 version becomes compatible with Google Analytics. Thanks!
Comment #5
nravens commentedI have Drupal 9.1.2 with AMP module Version: 8.x-3.5 and Google Analytics module 8.x-3.1 and also getting the Google Analytics validation error on my AMP pages.
How can we resolve this issue?
Comment #6
playful commentedComment #7
playful commentedDuplicate of https://www.drupal.org/project/amptheme/issues/2716943
Comment #8
playful commentedComment #9
playful commentedUpdated title and added related issue. The approach mentioned in that issue is not working with AMP 8.x-3.5.
Does anyone have any other suggestions for how this could be addressed?
Comment #10
jedihe commentedTo remove scripts added as html_head attachments, check this docs page.
For cases like mailchimp, check this method.
For more details about the two techniques, check #2731279: Add google_analytics hook to skip default GA integration for AMP pages