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

Measure ad-related layout shift #205

Merged
merged 17 commits into from
Jun 19, 2020
Merged

Conversation

warrengm
Copy link
Contributor

@warrengm warrengm commented Jun 8, 2020

Measures ad-related layout shift by summing scores across layout shifts where the old_rect was later occupied by an ad.

Some possible TODOs for follow-up PRs

  • Tune scores
  • Weigh the metric
  • Write docs
  • Audit Smoke Tests
  • Audit for best practices
  • Consider other metrics (# of ad related layout shifts or % of CLS attributable to ads in some way)
  • The metric currently only checks the ad's iframe when counting ad shifts, but we may want to consider the ad's parent or grandparent element to handle padding, etc.

Feedback would be appreciated

@googlebot googlebot added the cla: yes CLA has been signed label Jun 8, 2020

// Maybe we should look at the parent elements (created by the publisher and
// passed to the ad tag) rather than the iframe itself.
const ads = iframes.filter(isGptIframe);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to filter only ads in the viewport?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think so. Layout shift events are already limited to user-visible events and there shouldn't be too many ads for this to be a performance concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I'll see how much code complexity it adds

@warrengm warrengm marked this pull request as ready for review June 16, 2020 15:49
@warrengm warrengm merged commit 6eee495 into googleads:master Jun 19, 2020
@warrengm warrengm added the v1.2 label Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA has been signed v1.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants