Amp-ad AdSense doesn't display ads when amp-ad ad code is used on non-amp pages
After nearly a month since updating my website making it both amp and non-amp I have realized that AMP-ad code is not being filled when it appears on non-amp pages. I believe that this is bug, or if one prefers a feature request.
My site is designed such that I am using the same code for both amp and non-amp pages. When an user requests a page with the .amp extension a fully validated amp page is served, typically from the amp cache. If the user makes any subsequent clicks, or a direct requests for an .html page these request will be filled from my own server with a non-amp ".html" page that includes javascripts. However, the bulk of the code on the page remains unchanged. I am using a single template for both the amp and non-amp version.
Given this pattern, the ad code that appears on the page is amp-ad using Adsense. According to the reports in AdSense (and my drop in revenues) for ads served on AMP pages, the ratio of impressions to page views is close to 1, as is expected in my case given that I have 1 ad per page. However, for "Web" or non-amp pages the ratio is roughly 1 impression per 500 pages views. Note that this 1 in 500 is worse, than not at all, it shows that it can work but rarely does.
In my view this is as a bug that needs to be fixed. The bug may well be on AdSense's end. There is a stop-gap and that is to insert non-amp ad code for non-amp pages, but this becomes a maintenance issue as now all the templates need to be changed and new ad code needs to generated and all this needs to be maintained. This seems wrong to me, specially since all other amp features work even when a page is not valid amp-page, for example I don't need to implement different "form" code or carousel "code". So why ad code?
There is a lot that could be going on here. Could you give an example of you amp vs non-amp page?
Here is a typical example page. Note that I have now changed the ad-code on the non-amp page to be the standard Adsense ad-code. The example url is to the .html version, if you simply change the extension to .amp it will take you to the amp version. https://goo.gl/CVBFAs
If I'm understanding correctly, amp-ad (and AMP components generally) are not technically supported on non-AMP pages. E.g. 3P JS could violate the AMP JS's assumptions in myriad ways that are out of our control.
Do you have a version of the page that uses amp-ad so I could take a look? Note that amp-ad type=adsense is support on canonical publisher pages (otherwise valid AMP not served via the AMP cache) but delayed fetch is used instead of fast fetch for the concerns outlined by @choumx (see https://amphtml.wordpress.com/2017/08/21/even-faster-loading-ads-in-amp/ for info on fast fetch).
Do you have a version of the page that uses amp-ad so I could take a look? Go to the link I included above, then change the extension to ".amp" instead of ".html". That will take you to the AMP version of the page.
@choumx I'm a little confused by the statement
(and AMP components generally) are not technically supported on non-AMP pages. My understanding is, specifically with respect to service-workers and PWA's as described here: https://www.ampproject.org/docs/integration/pwa-amp/amp-as-pwa
The service-worker can be use to inject a script into the page once it takes over. Now my page does not currently work like this (my plan is to get to that in the not too distant future) but effectively the result is the same, the only significant difference between my amp and my non-amp page is only the addition of the script at the end of the page.
Now if I understand your statement correctly, what your are saying is that injecting a script into an AMP page can break the page? So how does the AMP-PWA pattern work?
I just went to the version of the page using amp-ad and I see an ad load correctly using delayed fetch as expected. Are you seeing ad requests made and do they fill?
The issue was not with the AMP pages. The issue was that the ads were rarely (less than 1% of the time) showing when using AMP-ad with Adsense code on non-amp pages. As I mentioned above, we have changed the non-amp pages to now use the standard AdSense ad code, and ad-serving has resumed to normal levels on the non-amp pages.
Now if I understand your statement correctly, what your are saying is that injecting a script into an AMP page can break the page? So how does the AMP-PWA pattern work?
Correct, injecting scripts onto AMP pages is not supported and may cause undefined behavior.
The AMP-PWA doesn't modify the nested AMP pages with scripts (or anything else that would cause the AMP Validator to fail).