-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2I: Allow AdSense ad size optimization for <amp-ad> #23568
Comments
Thank you @riklund Based on the design, all value will be calculated client side. The proposal LGTM. |
Looks like we need at least three approvers approval. https://github.com/ampproject/amphtml/blob/master/contributing/contributing-code.md#process-for-significant-changes I believe we've already got @cramforce's approval on this usage offline. @lannka Could you please take a look given this is ad related. Then we can proceed with the change. Thanks. |
LGTMed |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Summary
AdSense allows a per publisher server side setting for changing the ad size to responsive on mobile. We'd like to support this on AMP too.
Design
Retrieving server side settings
An ad creative returned from the AdSense ad server may contain the publisher opt in status to this feature. It will then be sent to the parent window, from the creative, using a post message.
We intend to install an event listener, very similar to this one, which will handle the setting response from the ad creative. Once we receive a setting response, we will check whether the publisher is opted in or not, and store the opt in status to localstorage under the key
aas-${data-ad-client}
where${data-ad-client}
is a value specified directly on the ad slot.Example ad slot (non-responsive):
Example localstorage content (opted in publisher):
Using settings
As early as possible when constructing an AdSense ad slot on an AMPHTML page, we will look up the value for key
aas-${data-ad-client}
in localstorage. If the value is set and true, we will try to set the size of the responsive slot according to the standard AdSense responsive size logic, which is available here.Note that this approach means that the first time a user visits a particular site, the settings won't be available yet, and we'll use the non-responsive ad size.
We only intend to support this feature for the a4a path.
Motivation
This change gives AdSense publishers feature parity on AMP compared to non-AMP with respect to the auto ad size optimization option. The server side opt in provides a convenient way for publishers to take advantage of the benefits of using a responsive ad format without having to re-tag their pages.
/cc @ampproject/wg-approvers @charliereams @tlong2 @wjfang @lannka @zhouyx @keithwrightbos
The text was updated successfully, but these errors were encountered: