diff --git a/common/app/conf/switches/ABTestSwitches.scala b/common/app/conf/switches/ABTestSwitches.scala index 980e5b0eb490..9f81705961e8 100644 --- a/common/app/conf/switches/ABTestSwitches.scala +++ b/common/app/conf/switches/ABTestSwitches.scala @@ -64,4 +64,14 @@ trait ABTestSwitches { sellByDate = Some(LocalDate.of(2024, 4, 2)), exposeClientSide = true, ) + + Switch( + ABTests, + "ab-block-supporter-revenue-messaging-sport", + "Block supporter revenue messaging in the Sport section", + owners = Seq(Owner.withEmail("commercial.dev@theguardian.com")), + safeState = Off, + sellByDate = Some(LocalDate.of(2024, 5, 31)), + exposeClientSide = true, + ) } diff --git a/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts b/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts index df0ecca8fa3e..381e66df4b4c 100644 --- a/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts +++ b/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts @@ -1,4 +1,5 @@ import type { ABTest } from '@guardian/ab-core'; +import { blockSupporterRevenueMessagingSport } from './tests/block-supporter-revenue-messaging-sport'; import { mpuWhenNoEpic } from './tests/mpu-when-no-epic'; import { oscarsNewsletterEmbed } from './tests/oscars-newsletter-embed'; import { remoteRRHeaderLinksTest } from './tests/remote-header-test'; @@ -17,4 +18,5 @@ export const concurrentTests: readonly ABTest[] = [ mpuWhenNoEpic, sectionAdDensity, oscarsNewsletterEmbed, + blockSupporterRevenueMessagingSport, ]; diff --git a/static/src/javascripts/projects/common/modules/experiments/tests/block-supporter-revenue-messaging-sport.ts b/static/src/javascripts/projects/common/modules/experiments/tests/block-supporter-revenue-messaging-sport.ts new file mode 100644 index 000000000000..6550799e814f --- /dev/null +++ b/static/src/javascripts/projects/common/modules/experiments/tests/block-supporter-revenue-messaging-sport.ts @@ -0,0 +1,31 @@ +import type { ABTest } from '@guardian/ab-core'; + +export const blockSupporterRevenueMessagingSport: ABTest = { + id: 'BlockSupporterRevenueMessagingSport', + author: '@commercial-dev', + start: '2024-03-14', + expiry: '2024-06-01', + audience: 0 / 100, + audienceOffset: 0 / 100, + audienceCriteria: 'Fronts and articles in the Sport section', + successMeasure: + 'Ad revenue and ad ratio increases without significantly impacting supporter revenue', + description: 'Block supporter revenue messaging in the Sport section', + variants: [ + { + id: 'control', + test: (): void => { + /* no-op */ + }, + }, + { + id: 'variant', + test: (): void => { + /* no-op */ + }, + }, + ], + canRun: () => + window.guardian.config.page.section === 'sport' || + window.guardian.config.page.section === 'football', +}; diff --git a/static/src/javascripts/projects/common/modules/support/banner.ts b/static/src/javascripts/projects/common/modules/support/banner.ts index 243ba2b7a42e..75766e6bb211 100644 --- a/static/src/javascripts/projects/common/modules/support/banner.ts +++ b/static/src/javascripts/projects/common/modules/support/banner.ts @@ -34,6 +34,8 @@ import userPrefs from 'common/modules/user-prefs'; import fastdom from 'lib/fastdom-promise'; import { getCountryCode } from 'lib/geolocation'; import { reportError } from 'lib/report-error'; +import { isInVariantSynchronous } from '../experiments/ab'; +import { blockSupporterRevenueMessagingSport } from '../experiments/tests/block-supporter-revenue-messaging-sport'; export const NO_RR_BANNER_TIMESTAMP_KEY = 'gu.noRRBannerTimestamp'; // timestamp of when we were last told not to show a RR banner const twentyMins = 20 * 60_000; @@ -165,11 +167,19 @@ export const fetchBannerData = async (): Promise => { const purchaseInfo = getPurchaseInfo(); const isSignedIn = await isUserLoggedIn(); const payload = await buildBannerPayload(purchaseInfo, isSignedIn); + const shouldHideBannerForTest = + isInVariantSynchronous( + blockSupporterRevenueMessagingSport, + 'variant', + ) && + (payload.targeting.sectionId === 'sport' || + payload.targeting.sectionId === 'football'); if ( payload.targeting.shouldHideReaderRevenue || payload.targeting.isPaidContent || - isHosted + isHosted || + shouldHideBannerForTest ) { return Promise.resolve(null); }