amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Intent to implement: <amp-auto-ads>

Open tlong2 opened this issue 10 years ago • 7 comments

I intend to implement an amp extension/tag named amp-auto-ads. This will be a framework for loading a configuration from a 3rd party server that is then used to control the automatic placement of <amp-ad>s within the page.

tlong2 avatar Nov 15 '16 15:11 tlong2

/to @lannka

jridgewell avatar Nov 15 '16 16:11 jridgewell

@tlong2 would you expand with some more details?

lannka avatar Nov 15 '16 18:11 lannka

I intend to implement this for use with AdSense, but the implementation will not be tied to anything specific to AdSense and so should be reusable by any other ad networks wanting to do something similar.

The plan is for the new element to extend AMP.BaseElement and initiate loading of a remote JSON configuration in its createdCallback (so the configuration can be loaded as early as possible).

The configuration will define where on the page ads should be placed by identifying an existing element using a query selector and specify whether the ad should be before, after, first child, or last child of it. How this configuration is generated is up to individual ad networks.

The initially inserted will be zero height and Resources.attemptChangeSize() function will be used to try and make them visible. This means that the AMP framework has ultimate control over whether an ad in a given position can show.

tlong2 avatar Nov 16 '16 09:11 tlong2

@tlong2 Hi there, following the reference by @lannka (lannka: Thanks for that!), I'm contacting you to understand if amp-auto-ads will help our engine adjust to AMP. If I understand correctly, amp-auto-ads require creating hidden placements in the markup - and according to a remote JSON, will fill these placements with ads when necessary. Am I understanding correctly?

DavidBrowsi avatar Jan 12 '17 13:01 DavidBrowsi

Hi,

The amp-auto-ads approach doesn't require the publisher to have created anything in the markup to specify where ads should go. The remote JSON config provides CSS selectors that identify places on the page where ads can go.

For the AdSense implementation that we're putting into AMP currently, the places that ads can go are decided by an offline process that analyzes the publisher's site to find visually sensible places that don't break the page. But what locations are in the JSON config and how it's created are completely up to the ad network/monetization engine that's serving it.

In some PRs we'll be sending soon will be some small bits of client-side page-analysis that are necessary. E.g. keeping track of where existing ads are so that any newly injected ads aren't too close to them.

Let me know if you need any more details.

tlong2 avatar Jan 12 '17 14:01 tlong2

@tlong2 Thanks for the detailed reply!

About the offline process you described, is it part of amp-auto-ads? How does the offline process keeps track of AMP pages that contains amp-auto-ads?

DavidBrowsi avatar Jan 12 '17 15:01 DavidBrowsi

I mentioned the AdSense offline system just as an example of how an ad network can create the JSON configs. Any offline systems/analysis are up to the network serving the config and are not part of amp-auto-ads, which is just the client-side AMP extension.

Any pages that have the tag will issue XHR config request to a URL specified in the network impl of https://github.com/ampproject/amphtml/blob/master/extensions/amp-auto-ads/0.1/ad-network-config.js#L29. So an offline process can make use of these requests.

tlong2 avatar Jan 16 '17 16:01 tlong2