All Collections
API Documentation
Global Optimization
Optimize Google AMP Display Based On Your Best Test Message
Optimize Google AMP Display Based On Your Best Test Message
Apply your best performing creatives to the display of your content on Google AMP
Naytev Team avatar
Written by Naytev Team
Updated over a week ago

Overview

Optimizing your content on AMP articles using Naytev's Global Optimization Service is as easy as updating the content on your page. Using the Naytev Results API, you will need to retrieve the data regarding your content. The response, either a 200 or 204 response, will share the best data if it is available. Once you have the winning variant, you can render it on your AMP page.

Update Your AMP Content

When render your AMP specified content you can replace the title, subheader and primary image with the content returned by Naytev. Here is an example in Ruby on Rails:

<script type="application/ld+json">
{
   "@context":"http://schema.org",
   "@type":"NewsArticle",
   "mainEntityOfPage":{
      "@type":"WebPage",
      "@id":"http://www.website.com/path-of-article"
   },
   "headline":"<%= @response.headline || @article.headline %>",
   "image":{
      "@type":"ImageObject",
      "url":"<%= @response.image || @article.image %>",
      "height":562,
      "width":750
   },
   "datePublished":"2016-10-12T18:14:38Z",
   "dateModified":"2015-02-05T09:20:00+08:00",
   "author":[
      {
         "@type":"Person",
         "name":"Hayley Peterson",
         "url":"http://www.website.com.com/path-of-article"
      }
   ],
   "publisher":{
      "@type":"Organization",
      "name":"Business Insider",
      "logo":{
         "@type":"ImageObject",
         "url":"http://www.website.com.com/path-of-logo",
         "width":600,
         "height":60
      }
   },
   "description":"<%= @response.description || @article.description %>"
}
</script>

You can also update any images or headlines within the content of your article. This is just updating HTML as normal.

Refresh Google AMP Cache

As long as the webservers manage the web page cache headers according to HTML standards, there is nothing you need to do to manual update the Google AMP chache. The Google AMP cache will automatically purge after 15 seconds. You can learn more about the AMP cache here: https://developers.google.com/amp/cache/overview

Did this answer your question?