Steve Workman
Steve Workman

Reputation: 325

Is it possible to serve AMP pages by user agent alone?

My website is adaptive, rather than responsive in its construction, with different templates for different user agent classifications (mobile and desktop/tablet). We do this through strong user agent detection and serving the content back with the Vary: user-agent header (as per Google's guidelines)

I'd like to keep this structure when creating AMP pages - detecting the user based on their user agent and sending back an AMP template.

Is this possible, and if so, what is the user agent that AMP uses?

Upvotes: 3

Views: 2057

Answers (3)

Malte Ubl
Malte Ubl

Reputation: 850

AMP user agents are just regular web browsers, so there really isn't a way to disambiguate them from all other web traffic. This is by design.

You can still implement an adaptive design based on AMP, where you use AMP to build the pages you deliver to a subset of users. E.g. you could use AMP only for your users on phones and respectively chose the AMP template for them.

Upvotes: 2

Steve Workman
Steve Workman

Reputation: 325

Answer from George Crawford:

The GoogleBot requests the AMP pages with its UA details on webmaster central blog

However, this won't really help you, as this is the same UA as the regular GoogleBot. AMP pages need to be discoverable from their canonical page, which Google wants to crawl, so if you restrict Google to only see AMP pages, then it won't be able to find the canonical page, so it won't crawl your content correctly.

Upvotes: 1

Andrew
Andrew

Reputation: 1203

Currently AMP search results are shown to mobile users only. And according to Google, a device is considered "mobile" if the display size is less than seven inches. So, from Google search results, you can just serve it to mobile devices.

Now, it would be a different story if you were to serve ALL of your pages using AMP, that is if I were to visit something like foo.bar or any other pages under that domain, I would be greeted with an AMP page, just like how ampproject.org is setup. But from my testing, the user agent isn't affected at all and should be identical to what you would get if it were a regular HTML page.

Upvotes: 0

Related Questions