ampproject / ampproject/amphtml

[amp-auto-ads] Multiple amp-auto-ads on the same page - adConstraints are not kept

Open
#31,840 9 comments 0 reactions 0 assignees View on GitHub
Stale
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I am trying to understand if multiple amp-auto-ads from different networks would work correctly if implemented simultaneously on the same page.
Currently I am facing the issue that adConstraints are not really kept. I think that each auto-ads instance keeps distance from ads that were previously present on the page, but they ignore ads created by each other.

Here is example link, where both AdSense and FirstImpression.io are implemented, both networks have constraint of at least one viewport height distance between ads, but ads still appear next to each other.

https://www.favecrafts.com/Knit-Baby-Blankets/Easy-Free-Knitting-Patterns-and-Help/amp#fi_reveal=113853 (preferably to look in mobile emulator)

Here how it looks like were the problem exists, ads are too close to each other:

![Screenshot from 2020-12-24 17-48-09](https://user-images.githubusercontent.com/10449753/103914237-2fe91e00-5112-11eb-8e14-7414c6e267e3.png)

Is this a config issue, or multiple amp-auto-ads are expeted to work like that?

**_Additional info:_**

AdConstriants from AdSense:
```

"adConstraints": {
"initialMinSpacing":"1vp",
"subsequentMinSpacing": [
{"adCount":3,"spacing":"2vp"},
{"adCount":6,"spacing":"3vp"}
],
"maxAdCount":8
}
```
AdConstraints from FirstImpression.io:

```
"adConstraints": {
"initialMinSpacing":"609px",
"subsequentMinSpacing": [{"adCount":10,"spacing":"200px"}],
"maxAdCount":100
}

```

@tlong2

Contributor guide

Open the contributing guide

Research direction

Start with the amp-auto-ads implementation and reproduce the behavior using the linked page in a mobile emulator, with AdSense and FirstImpression.io enabled together. Compare the configured adConstraints with the resulting ad spacing; done means determining whether constraints are shared across instances and documenting or correcting the observed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.