diff --git a/common/app/conf/switches/ABTestSwitches.scala b/common/app/conf/switches/ABTestSwitches.scala index aca242daf62..42bef7848cb 100644 --- a/common/app/conf/switches/ABTestSwitches.scala +++ b/common/app/conf/switches/ABTestSwitches.scala @@ -71,6 +71,17 @@ trait ABTestSwitches { highImpact = false, ) + Switch( + ABTests, + "ab-consent-or-pay-banner", + "Test impact of adding consent or pay banner", + owners = Seq(Owner.withEmail("transparencyandconsent@theguardian.com")), + safeState = Off, + sellByDate = Some(LocalDate.of(2025, 12, 24)), + exposeClientSide = true, + highImpact = false, + ) + Switch( ABTests, "ab-the-trade-desk", diff --git a/common/app/conf/switches/PrivacySwitches.scala b/common/app/conf/switches/PrivacySwitches.scala index 2b4ba929691..41b6581e3cf 100644 --- a/common/app/conf/switches/PrivacySwitches.scala +++ b/common/app/conf/switches/PrivacySwitches.scala @@ -20,4 +20,16 @@ trait PrivacySwitches { "Warning: Requires ExCo sign-off. Disabling this switch will cost £160,000/day in ad-revenue, impact marketing, impact reader revenue...", ), ) + + val ConsentOrPay = Switch( + group = SwitchGroup.Privacy, + name = "consent-or-pay", + description = "Enable consent or pay logic", + owners = + Seq(Owner.withEmail("Transparency.and.consent@guardian.co.uk"), Owner.withEmail("identitydev@guardian.co.uk")), + safeState = On, + sellByDate = never, + exposeClientSide = true, + highImpact = true, + ) } diff --git a/common/app/experiments/Experiments.scala b/common/app/experiments/Experiments.scala index e41d7a22ccf..e96b886edcc 100644 --- a/common/app/experiments/Experiments.scala +++ b/common/app/experiments/Experiments.scala @@ -15,6 +15,7 @@ object ActiveExperiments extends ExperimentsDefinition { LoopVideoTest, DCRCrosswords, DarkModeWeb, + ConsentOrPay, ) implicit val canCheckExperiment: CanCheckExperiment = new CanCheckExperiment(this) } @@ -58,3 +59,12 @@ object DarkModeWeb sellByDate = LocalDate.of(2025, 4, 30), participationGroup = Perc0D, ) + +object ConsentOrPay + extends Experiment( + name = "consent-or-pay", + description = "Enable the switch for consent or paywall", + owners = Seq(Owner.withEmail("transparency.and.consent@guardian.co.uk ")), + sellByDate = LocalDate.of(2025, 12, 30), + participationGroup = Perc0E, + ) diff --git a/package.json b/package.json index 22e8797faaa..28d67791d55 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@guardian/eslint-config-typescript": "9.0.1", "@guardian/identity-auth": "3.0.0", "@guardian/identity-auth-frontend": "6.0.3", - "@guardian/libs": "20.0.0", + "@guardian/libs": "0.0.0-canary-20250210172703", "@guardian/prettier": "^8.0.1", "@guardian/shimport": "^1.0.2", "@guardian/source-foundations": "16.0.0", diff --git a/static/src/javascripts/boot.js b/static/src/javascripts/boot.js index 47fab0c5a70..25deacdf6f7 100644 --- a/static/src/javascripts/boot.js +++ b/static/src/javascripts/boot.js @@ -118,7 +118,12 @@ const go = () => { }); - cmp.init({ pubData, country: await getLocale() }); + cmp.init({ + pubData, + country: await getLocale(), + isUserSignedIn: window.location.search.includes('CMP_SIGNED_IN'), + useNonAdvertisedList: window.location.search.includes('CMP_MAIN'), + }); /** * Handle Ad blockers 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 e727132aafa..6a12f875508 100644 --- a/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts +++ b/static/src/javascripts/projects/common/modules/experiments/ab-tests.ts @@ -1,5 +1,6 @@ import type { ABTest } from '@guardian/ab-core'; import { auxiaSignInGate } from './tests/auxia-sign-in-gate'; +import { consentOrPayBannerTest } from './tests/consent-or-pay-banner'; import { remoteRRHeaderLinksTest } from './tests/remote-header-test'; import { signInGateMainControl } from './tests/sign-in-gate-main-control'; import { signInGateMainVariant } from './tests/sign-in-gate-main-variant'; @@ -7,6 +8,7 @@ import { signInGateMainVariant } from './tests/sign-in-gate-main-variant'; // keep in sync with ab-tests in dotcom-rendering // https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/src/web/experiments/ab-tests.ts export const concurrentTests: readonly ABTest[] = [ + consentOrPayBannerTest, signInGateMainVariant, signInGateMainControl, remoteRRHeaderLinksTest, diff --git a/static/src/javascripts/projects/common/modules/experiments/tests/consent-or-pay-banner.js b/static/src/javascripts/projects/common/modules/experiments/tests/consent-or-pay-banner.js new file mode 100644 index 00000000000..5888f4ff18a --- /dev/null +++ b/static/src/javascripts/projects/common/modules/experiments/tests/consent-or-pay-banner.js @@ -0,0 +1,27 @@ +export const consentOrPayBannerTest = { + id: 'ConsentOrPayBanner', + start: '2025-01-01', + expiry: '2025-12-31', + author: 'Akinsola Lawanson', + description: + 'Test the consent or pay banner', + audience: 0.0, + audienceOffset: 0, + successMeasure: 'TBC', + audienceCriteria: + 'all pageviews in UK', + dataLinkNames: 'consent-or-pay-banner', + idealOutcome: 'TBC', + showForSensitive: false, + canRun : () => true, + variants: [ + { + id: 'activate', + test: () => {}, + }, + { + id: 'deactivate', + test: () => {}, + }, + ], +} diff --git a/yarn.lock b/yarn.lock index 86d6508d46e..461e15a011c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3758,7 +3758,7 @@ __metadata: "@guardian/eslint-config-typescript": "npm:9.0.1" "@guardian/identity-auth": "npm:3.0.0" "@guardian/identity-auth-frontend": "npm:6.0.3" - "@guardian/libs": "npm:20.0.0" + "@guardian/libs": "npm:0.0.0-canary-20250210172703" "@guardian/prettier": "npm:^8.0.1" "@guardian/shimport": "npm:^1.0.2" "@guardian/source-foundations": "npm:16.0.0" @@ -3915,16 +3915,16 @@ __metadata: languageName: node linkType: hard -"@guardian/libs@npm:20.0.0": - version: 20.0.0 - resolution: "@guardian/libs@npm:20.0.0" +"@guardian/libs@npm:0.0.0-canary-20250210172703": + version: 0.0.0-canary-20250210172703 + resolution: "@guardian/libs@npm:0.0.0-canary-20250210172703" peerDependencies: tslib: ^2.6.2 typescript: ~5.5.2 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/0ab14266f3de53da978a60dc0bcbf09cf9f5350fe070dbfd858d1bfa55bf8e802c18513c579674777e9a69efb2b1f672b815eb7c81b98c97b993ac68f73bda3c + checksum: 10c0/8132f86b9a3a239db7ebd803b2c47301ffa3457643a8283983e5226bb9fb091ff66b4707179e96ed7fee79a5a02260022d03b9dee86455f312d81c8aee42fdd9 languageName: node linkType: hard