Skip to content

Commit c666048

Browse files
committed
Revert banner:none event dispatch
1 parent f912e23 commit c666048

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

ab-testing/config/abTests.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ const ABTests: ABTest[] = [
107107
groups: ["control", "stacked", "carousel"],
108108
shouldForceMetricsCollection: false,
109109
},
110+
{
111+
name: "commercial-banner-ad-coordination",
112+
description:
113+
"Dispatches events to coordinate mobile sticky ad placement with banners. Currently disabled due to CMP banner incorrectly blocking ads.",
114+
owners: ["commercial.dev@guardian.co.uk"],
115+
expirationDate: "2026-03-01",
116+
type: "client",
117+
status: "ON",
118+
audienceSize: 0 / 100,
119+
audienceSpace: "A",
120+
groups: ["control", "variant"],
121+
shouldForceMetricsCollection: false,
122+
},
110123
];
111124

112125
const activeABtests = ABTests.filter((test) => test.status === "ON");

dotcom-rendering/src/components/StickyBottomBanner.importable.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
SlotConfig,
1616
} from '../lib/messagePicker';
1717
import { pickMessage } from '../lib/messagePicker';
18-
import { useAB } from '../lib/useAB';
18+
import { useAB, useBetaAB } from '../lib/useAB';
1919
import { useIsSignedIn } from '../lib/useAuthStatus';
2020
import { useBraze } from '../lib/useBraze';
2121
import { useCountryCode } from '../lib/useCountryCode';
@@ -269,6 +269,7 @@ export const StickyBottomBanner = ({
269269
const isSignedIn = useIsSignedIn();
270270
const ophanPageViewId = usePageViewId(renderingTarget);
271271
const abTestAPI = useAB()?.api;
272+
const betaABTest = useBetaAB();
272273
const isInAuxiaControlGroup = !!abTestAPI?.isUserInVariant(
273274
'NoAuxiaSignInGate',
274275
'control',
@@ -409,11 +410,23 @@ export const StickyBottomBanner = ({
409410
// Dispatches 'banner:none' event for mobile sticky ad integration (see @guardian/commercial-dev).
410411
// Ensures ads only insert when no banner will be shown.
411412
// hasPickMessageCompleted distinguishes between initial state (not picked yet) and final state (picked nothing).
413+
// Gated behind commercial-banner-ad-coordination A/B test (currently at 0%) - users in variant will NOT get the event
412414
useEffect(() => {
413-
if (hasPickMessageCompleted && SelectedBanner == null) {
415+
const isInBannerAdTest =
416+
betaABTest?.isUserInTestGroup(
417+
'commercial-banner-ad-coordination',
418+
'variant',
419+
) ?? false;
420+
421+
if (
422+
!isInBannerAdTest &&
423+
hasPickMessageCompleted &&
424+
SelectedBanner == null
425+
) {
414426
document.dispatchEvent(new CustomEvent('banner:none'));
415427
}
416-
}, [SelectedBanner, hasPickMessageCompleted]);
428+
}, [SelectedBanner, hasPickMessageCompleted, betaABTest]);
429+
417430
if (SelectedBanner) {
418431
return <SelectedBanner />;
419432
}

0 commit comments

Comments
 (0)