Render mobile sticky ads only if reader revenue banner is absent#2351
Render mobile sticky ads only if reader revenue banner is absent#2351dskamiotis merged 8 commits intomainfrom
Conversation
|
785cc3f to
d54a028
Compare
|
Size Change: +78 B (+0.03%) Total Size: 242 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)
There was a problem hiding this comment.
Good point. I've added a comment in the test noting this fragility.
If the text changes break this, we should work with the Supporter Revenue
to add stable test IDs.
7891d65 to
fe3a575
Compare
|
Seen on PROD (merged by @dskamiotis 2 minutes and 4 seconds ago) Please check your changes! |
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