Getting Google Optimize plugin to work with AMP
-
I’m having trouble getting Google Optimize working together with AMP. My setup:
- WordPress 5.4.1
- Child theme of Twenty Twenty
- AMP plugin
- “amp-experiments script version rollback” plugin
- MonsterInsights Pro plugin, with Google Optimize and Google AMP Addons
I’ve set up Google Analytics (tracking fine in both Google Analytics itself and in MonsterInsights), and Google Optimize – which is running fine as long as I deactivate AMP.
I have also inserted the container code in the Optimize Addon for MonsterInsights Pro.
The problem is that I can’t get Google Optimize to work with AMP enabled. The live debugger for the page where I’m running the experiment (https://www.onlinecoursewizards.com/page-a/) says:
“The Google Optimize snippet for the container with ID GTM-KD4XQRK is not correctly installed on this page. To preview experiences or debug the container, make sure the Google Optimize snippet is installed on any pages you want to test.”
I have tried to follow this guide: https://developers.google.com/optimize/devguides/amp-experiments. The first instruction there is to include the
<amp-experiment>
and<amp-analytics>
components.But if I try to add
<amp-experiment>
tag to my template’s header.php file as follows:<script async custom-element=”amp-experiment” src=”https://cdn.ampproject.org/v0/amp-experiment-0.1.js”></script>
– then the tag is removed from the source code upon rendering the page.
I was wondering if you’d have any tips to get Google Optimize to play nicely with AMP?
The page I need help with: [log in to see the link]
- The topic ‘Getting Google Optimize plugin to work with AMP’ is closed to new replies.