ampproject / ampproject/amphtml
amp-subscription + amd-ad: subscriptions-display ist ignored and hidden ad is loaded
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## What's the issue?
When using `subscriptions-display` attribute to hide ads for subscribed users results, ads are loaded in a hidden iframe.
While investigating the problem I noticed this isn't always the case. It seems this only affects `amp-ads` configured with `layout="fluid"` (for multi-size ads). However, `amp-ads` configured with `layout="fixed"` are behaving as expected.
## How do we reproduce the issue?
You'll need an amp page with `amp-subscription` to reproduce the error. Try to hide/show ads based based on subscription state and use the following code snippets.
**Works as expected:**
```
```
**Doesn't work:**
```
```
The latter one results in a hidden div, which loads the ad (see the iframe within the `amp-ad` container).
Contributor guide
Research direction
Reproduce the issue with the provided amp-subscription and amp-ad snippets, comparing fluid and fixed layouts while toggling the subscription state. Trace why a fluid amp-ad inside subscriptions-display loads an iframe while hidden, and consider the issue complete when hidden fluid ads no longer load while the fixed-layout behavior remains correct.
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
- Mostly clear
- Newbie friendliness
- 35/100