Skip to content
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

Implement new loader for ads #23687

Merged
merged 21 commits into from
Aug 7, 2019
Merged

Implement new loader for ads #23687

merged 21 commits into from
Aug 7, 2019

Conversation

sparhami
Copy link

@sparhami sparhami commented Aug 5, 2019

  • Put the ads loader in to amp-loader for now, since it seems difficult to make sure all ads loaders get it otherwise.
  • Disable the default placeholder for ads when the new experiment is enabled, since the ad logo overlaps with the logo from the loader.
  • Update manual test page to set localDev, which is needed when starting a local server.

Sepand Parhami added 16 commits July 31, 2019 15:36
- Move some presentation logic from JS into CSS
- Change custom logos to define their own SVGs
  * This separates concerns better, allowing the logos to specify their
  own viewbox for example
- Make API for custom loaders specifying a color more explicit (rather
than just reading it off the custom loader Element)
- Change coordinate systems for the logos to start at zero so they are easier
  to reason about.
- Fix the default loader size, which defaults to 300x300 on Firefox when
no size is specified.
- Fix the smaller loader being the wrong size, due to the SVG being
sized down. This may overflow the parent container, but should position
correctly as it is centered.
- Ad localDev flag to test page.
// Not Implemented
return false;
return (
this.element_.tagName == 'AMP-AD' || this.element_.tagName == 'AMP-EMBED'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current behavior: we don't apply placeholder to <amp-embed>, because <amp-embed> component is usually pretty long, multiple viewport height. And we figure it's not good UI to apply loader in such case.
https://github.com/ampproject/amphtml/blob/master/extensions/amp-ad/0.1/amp-ad-ui.js#L143

But I know @lannka propose that we remove all differences between <amp-ad> and <amp-embed> and make them exactly the same component.

Can we please keep the same behavior for now (not adding loader to <amp-embed>. I'm open to future change if we agree on the loader UI for elements that's longer than 100vh. Thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After taking a look, I noticed that <amp-embed> currently gets the 3 dot loader (and not the ads loader). The loader element is due to the inclusion in this list:

amphtml/src/layout.js

Lines 94 to 109 in ff8827b

export const LOADING_ELEMENTS_ = {
'AMP-AD': true,
'AMP-ANIM': true,
'AMP-EMBED': true,
'AMP-FACEBOOK': true,
'AMP-FACEBOOK-COMMENTS': true,
'AMP-FACEBOOK-PAGE': true,
'AMP-GOOGLE-DOCUMENT-EMBED': true,
'AMP-IFRAME': true,
'AMP-IMG': true,
'AMP-INSTAGRAM': true,
'AMP-LIST': true,
'AMP-PINTEREST': true,
'AMP-PLAYBUZZ': true,
'AMP-TWITTER': true,
};

which was added in 919ba58

Since we want to remove the legacy loader, I think we should either:

  1. Move forward with the new ads loader for <amp-embed>
  2. Move forward with the new generic loader for <amp-embed>
  3. Remove the the loader element from <amp-embed> as part of the experiment / ramp up to measure the impact.

Any thoughts on which would be preferred?

@zhouyx @nainar @lannka

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our discussion, we will go with the generic loader for now, since that matches the current intent / implementation.

*/
createPlaceholder() {
if (isNewLoaderExperimentEnabled(this.element_)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the current plan on the new loader experiment? Curious what data we collect from the experiment.
cc @keithwrightbos Do you see any potential impact on ads side with the default loader change? Thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current plan is to have a ramp up schedule of 1%, 10%, 50%, and then 100% with a minimum one week spacing at each stage to verify metrics are not impacted beyond what we might reasonably expect and to understand the scope of the impact.

@nainar Who might have more context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our decision on the loader and placeholder. If we decide to keep the ad icon as the placeholder, should we keep the old logic here because we will always need the ad icon

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new loader renders the "ad" icon as a part of the loader (in the middle of the spinner). So in that case, we don't want to create the placeholder here. Eventually, we should remove the default placeholder logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks
In this case, can I assume the ad icon will still be displayed on top of the publisher provided placeholder.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we'll display a circle with a dark (but translucent) grey background on top of the placeholder, then the spinner / logo on top of that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks

Copy link
Contributor

@wassgha wassgha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

extensions/amp-loader/0.1/amp-loader.js Outdated Show resolved Hide resolved
Sepand Parhami added 3 commits August 5, 2019 17:42
- This makes sure that the logo, text are truely centered and gives more
leeway for font rendering.
Copy link
Contributor

@zhouyx zhouyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sparhami sparhami merged commit 573859f into ampproject:master Aug 7, 2019
@sparhami sparhami deleted the ad-loader branch August 7, 2019 00:41
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
- Implement new loader for ads (amp-ad)
- Make amp-embed use the default loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants