AMP experiment non-results

April 27th, 2018
tech
A couple months ago I made an AMP version of my site, and set up a 50-50 A/B test to see how it worked. Unfortunately, the experiment had issues: there were 30% more AMP loads than non-AMP loads in what was supposed to be a 50-50 page diverted experiment. What went wrong?

I set up my experiment as:

http {
  ...
  split_clients $msec $amp {
    50% ".amp";
    * "";
  }
  server {
    ...
    rewrite ^(/p/(?!index)..*) $1$amp last;
  }
}
What this did was take visitors requesting /p/some-post and half the time serve them the contents of /p/some-post.amp instead. Looks good, right?

Unfortunately, I also (as you're recommended to do) linked between my AMP and non-AMP pages with <link rel=canonical "/p/some-post"> on my AMP page and <link rel=amphtml "/p/some-post.amp"> on my non-AMP page. Search engines, though probably only Google right now, use that link to sometimes show people the AMP version of a page in search, and hence the extra page views.

The right way to do this would have been to not include the rel=amphtml link, and to make /p/some-post.amp inacessible by direct url. Then users would be diverted on each load and everything would be fine.

Except for another problem, which is that Google expects that a page wil not jump back and forth between being AMP and not. Google preloads AMP pages, and it looks like it does this in multiple passes where it first sees that a page is AMP and then later caches the current version. So if it sees AMP initially, and then when serving it to a user gets non-AMP, the prerendering is broken. The user sees a flash of this error page:

and then is quickly redirected to the canonical (non-AMP) page.

This breaks the main advantage of AMP, which is that it can be safely cached and preloaded.

I could re-run this experiment based on a hash of the url, which would be stable and so not mess up Google, but I'm feeling done and have turned it off instead. People will get the non-AMP versions of pages normally, and only get AMP versions when they're coming from somewhere that interprets rel=amphtml links. [1]

(Taymon pointed out that this would be a problem when I first proposed the experiment, but I kept putting off dealing with it until I saw the error page flash by me when clicking on a link to my site on mobile.)


[1] Or if you manually append .amp to urls.

Referenced in: Trying out AMP

Comment via: google plus, facebook

Recent posts on blogs I like:

Jealousy In Polyamory Isn't A Big Problem And I'm Tired Of Being Gaslit By Big Self-Help

The nuance is in the post, guys

via Thing of Things July 18, 2024

Trust as a bottleneck to growing teams quickly

non-trust is reasonable • trust lets collaboration scale • symptoms of trust deficit • how to proactively build trust

via benkuhn.net July 13, 2024

Coaching kids as they learn to climb

Helping kids learn to climb things that are at the edge of their ability The post Coaching kids as they learn to climb appeared first on Otherwise.

via Otherwise July 10, 2024

more     (via openring)