Google optimize integration
-
Hi,
I’m trying to run some A/B tests with Optimize on my AMP (WordPress) Website.
I’m adding my analytics setup through the amp_analytics_entries filter provided by the plugin. I will show you the final HTML output in the source page.What I’ve done so far:
- I’ve made sure that both amp-experiment and amp-analytics scripts are included in my page(the WordPress plugin includes all the required scripts automatically.)
- Setup an experiment named testExperiment. Its ID is 51vXPC_HQcCA-kjuWP5XFQ.
- Potential problem: Optimize diagnostics shows the following errors:
Analytics tracking code not found
Optimize plugin not found
Analytics is 100% integrated, as it shows live views on my website. I suppose that the diagnostics are not working correctly due to the specific AMP integration process. - I’ve created a variant, created targeting rule, linked with analytics, set up an objective.
- I’ve added the following amp-experiment code in my page.?
<amp-experiment> <script type="application/json"> { "testExperiment": { "sticky": false, "variants": { "0": 50, "1": 50 } } } </script> </amp-experiment>
?My analytics script looks like this:
<script type="application/json"> { "vars": { "account": "UA-54160702-17" }, "requests": { "experiment": "${pageview}&xid=${xid}&xvar=${xvar}" }, "triggers": { "trackPageview": { "on": "visible", "request": "pageview", "extraUrlParams": [] }, "pageview": { "on": "visible", "request": "experiment", "vars": { "xid": "51vXPC_HQcCA-kjuWP5XFQ", "xvar": "VARIANT(testExperiment)" } } }, "transport": { "beacon": "true", "xhrpost": "true", "image": "false" } } </script>
- I’ve added the following CSS to my page:
body[amp-x-testExperiment="0"] .clr-expr { background-color: #00cebe } body[amp-x-testExperiment="1"] .clr-expr { background-color: #353c8c }
?
The experiment attribute is not added to the body of the page and I’m seeing the following errors in the console:
[amp-experiment] Experiment amp-experiment-1.0 is not enabled.
“Experiment amp-experiment-1.0 is not enabled.” <amp-experiment class=?”i-amphtml-element i-amphtml-notbuilt amp-notbuilt i-amphtml-layout-container i-amphtml-error” i-amphtml-layout=?”container”>?…?</amp-experiment>?
failed to build: amp-experiment#1 Experiment amp-experiment-1.0 is not enabled.
Uncaught (in promise) Experiment amp-experiment-1.0 is not enabled.The page I’m trying to test on is: https://dev.somnishop.com/was-tun-gegen-schnarchen-frauen/
Any suggestions will be appreciated.
The page I need help with: [log in to see the link]
- The topic ‘Google optimize integration’ is closed to new replies.