Heya AMP team,
We've noticed that amp x intermittently fails to "switch on" - it takes a couple of refreshes to get it working.
I've been able to verify the above from the following:
Feedback on this highly appreciated. 馃檪
N/A (In development, requires authorisation), sorry.
All browsers.
AMP - https://cdn.ampproject.org/v0.js
AMP Experiment - https://cdn.ampproject.org/v0/amp-experiment-0.1.js
https://stackoverflow.com/questions/49672039/amp-experiment-fails-to-switch-on
@choumx Can you comment on whether this is expected?
Ah, I think there's some confusion due to a naming collision. AMP.isExperimentOn is for internal features listed here and is unrelated to the amp-experiment extension.
@rsimha @choumx thanks for the response. AMP.isExperimentOn() was as an example; my bad. Are you able to comment on why AMP X does not always switch on on first load?
There might be a small latency after page load for the amp-experiment extension to load etc.
Do you have a sample page that is exhibiting this behavior?
Thanks for reopening the issue @choumx. I'm afraid I'm unable to share the asset here as it's still in development/requires authorisation.
I've made a quick pen here https://jsbin.com/kivuxid/edit?html,output for a sample of what we're looking at.
So far I'm ruling out the following:
Thanks for the jsbin. I can't reproduce amp-x-foo-bar-experiment not being set on the <body> even with network throttling, and look at the source code I don't see a timeout. As long as the fetch of the amp-experiment extension itself completes, this should work.
/cc @lannka
hmm, no worries. I'll see if there's any other way I can reproduce the issue. Cheers! 馃憤
Thanks and good luck!
_Cross-sharing this from slack._
Hello
I鈥檓 reaching out to provide another sample amp document for use in resolving this issue,as raised by Austin.
Since the actual sample amp document requires credentials, that we aren鈥檛 able to share, to access, I have copied the raw html on the amp document, returned by accessing the link in the steps below.
The validator shall report errors for this webpage because of the inline style
clauses found in the raw html.
Please use the steps below to view the reported issue and advise on how we should proceed to have the issue resolved.
Steps to reproduce
1.On a new tab, on chrome, open developer tools and toggle device toolbar.
2.Select Mobile L - 425px
2.Go to https://a-referrer.000webhostapp.com/amp-experiment/indonesia.html
The steps outlined above, return a page with a working amp experiment, when carried out in an incognito window.
Below are screen grabs for the page above as seen on a normal window, incognito window and iPhone 6s safari respectively.
normal window - chrome

incognito window - chrome

iPhone 6 - safari

Thank you.
@lannka Did you port the fixes for the service registration race that @jpettitt debugged?
Thanks all for the help! Happy to report back that the experiment is working correctly on our sites. 馃帀
Most helpful comment
Thanks all for the help! Happy to report back that the experiment is working correctly on our sites. 馃帀