Skip to content

Commit

Permalink
Merge pull request #26989 from guardian/ei/block-supporter-revenue-me…
Browse files Browse the repository at this point in the history
…ssaging-sport

Block supporter revenue messaging in the Sport section
  • Loading branch information
domlander authored Mar 27, 2024
2 parents 068d3e6 + c6fe6f0 commit ebe944b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
10 changes: 10 additions & 0 deletions common/app/conf/switches/ABTestSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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("[email protected]")),
safeState = Off,
sellByDate = Some(LocalDate.of(2024, 5, 31)),
exposeClientSide = true,
)
}
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -17,4 +18,5 @@ export const concurrentTests: readonly ABTest[] = [
mpuWhenNoEpic,
sectionAdDensity,
oscarsNewsletterEmbed,
blockSupporterRevenueMessagingSport,
];
Original file line number Diff line number Diff line change
@@ -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',
};
12 changes: 11 additions & 1 deletion static/src/javascripts/projects/common/modules/support/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -165,11 +167,19 @@ export const fetchBannerData = async (): Promise<ModuleDataResponse | null> => {
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);
}
Expand Down

0 comments on commit ebe944b

Please sign in to comment.