Render mobile sticky ads only if reader revenue banner is absent#2351
Render mobile sticky ads only if reader revenue banner is absent#2351dskamiotis wants to merge 7 commits intomainfrom
Conversation
|
785cc3f to
d54a028
Compare
|
Size Change: +94 B (+0.04%) Total Size: 225 kB
ℹ️ View Unchanged
|
201e6b4 to
1422c34
Compare
cemms1
left a comment
There was a problem hiding this comment.
Looking great and really neat! Nice one adding a Playwright test too!
|
|
||
| // Dismiss banner | ||
| await page.getByRole('button', { name: 'Collapse banner' }).click(); | ||
| await page.getByText('Maybe later').click(); |
There was a problem hiding this comment.
This text could change so is a bit fragile, but we don't have anything better here due to the way it appears in the DOM! If we find this test fails due to text changes, we should try to establish a more concrete identifier for this button (and the previous "Collapse banner" one)
What does this change?
The mobile sticky ad slot now responds to banner lifecycle events from DCR, ensuring it only displays when engagement banners are not present.
Why?
Mobile sticky ads and engagement banners compete for the same screen real estate at the bottom of the viewport. Previously, both could display simultaneously, creating a poor user experience. This change ensures the mobile sticky ad only appears when there's no banner conflict.
This prevents ads from showing up in the DOM and going against google ad policy
Related to guardian/dotcom-rendering#15053 which implements new event being emitted.
Event handling:
banner:closeandbanner:noneevents dispatched by DCRbanner:none), the ad loads immediatelyTesting:
banner:nonetriggers ad loadingTesting done
banner:noneevent triggers ad loading when no banner present