Skip to content

Render mobile sticky ads only if reader revenue banner is absent#2351

Merged
dskamiotis merged 8 commits intomainfrom
ds/load-mobile-sticky-ads-conditionally
Feb 9, 2026
Merged

Render mobile sticky ads only if reader revenue banner is absent#2351
dskamiotis merged 8 commits intomainfrom
ds/load-mobile-sticky-ads-conditionally

Conversation

@dskamiotis
Copy link
Copy Markdown
Contributor

@dskamiotis dskamiotis commented Dec 22, 2025

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:

  • Added event listeners for banner:close and banner:none events dispatched by DCR
  • Mobile sticky ad slot now loads conditionally based on banner state
  • When a banner closes, the mobile sticky ad is inserted into the page
  • When no banner is present (banner:none), the ad loads immediately

Testing:

  • Added Playwright E2E tests to verify banner/ad interaction flow
  • Test user journey: banner display → banner dismissal → ad appearance
  • Test event-driven behavior: banner:none triggers ad loading
  • Removed manual event dispatch in favor of realistic UI interactions (button clicks)

Testing done

  • ✅ Playwright tests pass for mobile viewport
  • ✅ Verified banner shows first, blocking mobile sticky ad
  • ✅ Verified mobile sticky ad appears after banner dismissal
  • ✅ Verified banner:none event triggers ad loading when no banner present

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Dec 22, 2025

⚠️ No Changeset found

Latest commit: 6ceae7a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dskamiotis dskamiotis force-pushed the ds/load-mobile-sticky-ads-conditionally branch from 785cc3f to d54a028 Compare December 22, 2025 10:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 22, 2025

Size Change: +78 B (+0.03%)

Total Size: 242 kB

Filename Size Change
bundle/dist/prod/artifacts/commercial/********************/graun.consented-advertising.commercial.js 29.2 kB +78 B (+0.27%)
ℹ️ View Unchanged
Filename Size
bundle/dist/prod/artifacts/commercial/********************/graun.3.commercial.js 14.4 kB
bundle/dist/prod/artifacts/commercial/********************/graun.148.commercial.js 4.36 kB
bundle/dist/prod/artifacts/commercial/********************/graun.207.commercial.js 20.6 kB
bundle/dist/prod/artifacts/commercial/********************/graun.317.commercial.js 617 B
bundle/dist/prod/artifacts/commercial/********************/graun.598.commercial.js 127 kB
bundle/dist/prod/artifacts/commercial/********************/graun.605.commercial.js 5.24 kB
bundle/dist/prod/artifacts/commercial/********************/graun.765.commercial.js 13.5 kB
bundle/dist/prod/artifacts/commercial/********************/graun.ad-free.commercial.js 4.46 kB
bundle/dist/prod/artifacts/commercial/********************/graun.consentless-advertising.commercial.js 1.8 kB
bundle/dist/prod/artifacts/commercial/********************/graun.Prebid.js.commercial.js 2.51 kB
bundle/dist/prod/artifacts/commercial/********************/graun.standalone.commercial.js 19.1 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 22, 2025

@dskamiotis dskamiotis changed the title Load mobile sticky ads only when the reader revenue banner is not pre… Render mobile sticky ads only if reader revenue banner is absent Dec 22, 2025
@dskamiotis dskamiotis added health feature Departmental tracking: work on a new feature and removed health labels Dec 22, 2025
@dskamiotis dskamiotis force-pushed the ds/load-mobile-sticky-ads-conditionally branch from 201e6b4 to 1422c34 Compare January 8, 2026 11:39
@dskamiotis dskamiotis marked this pull request as ready for review January 8, 2026 11:40
@dskamiotis dskamiotis requested a review from a team as a code owner January 8, 2026 11:40
Copy link
Copy Markdown
Contributor

@cemms1 cemms1 left a comment

Choose a reason for hiding this comment

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

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();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread bundle/playwright/tests/mobile-sticky-slot.spec.ts Outdated
@dskamiotis dskamiotis force-pushed the ds/load-mobile-sticky-ads-conditionally branch from 7891d65 to fe3a575 Compare February 9, 2026 11:32
@dskamiotis dskamiotis merged commit a001baf into main Feb 9, 2026
16 checks passed
@dskamiotis dskamiotis deleted the ds/load-mobile-sticky-ads-conditionally branch February 9, 2026 11:48
@gu-prout
Copy link
Copy Markdown

gu-prout Bot commented Feb 9, 2026

Seen on PROD (merged by @dskamiotis 2 minutes and 4 seconds ago) Please check your changes!

dskamiotis added a commit that referenced this pull request Feb 13, 2026
cemms1 pushed a commit that referenced this pull request Feb 13, 2026
…ent" (#2409)

Revert "Render mobile sticky ads only if reader revenue banner is absent (#2351)"

This reverts commit a001baf.
dskamiotis added a commit that referenced this pull request Feb 13, 2026
…ent" (#2409)

Revert "Render mobile sticky ads only if reader revenue banner is absent (#2351)"

This reverts commit a001baf.
dskamiotis added a commit that referenced this pull request Feb 13, 2026
…ent" (#2409)

Revert "Render mobile sticky ads only if reader revenue banner is absent (#2351)"

This reverts commit a001baf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature Seen-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants