Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ab-test for Consent or Pay #27747

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions common/app/conf/switches/ABTestSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions common/app/conf/switches/PrivacySwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
10 changes: 10 additions & 0 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object ActiveExperiments extends ExperimentsDefinition {
LoopVideoTest,
DCRCrosswords,
DarkModeWeb,
ConsentOrPay,
)
implicit val canCheckExperiment: CanCheckExperiment = new CanCheckExperiment(this)
}
Expand Down Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-20250210165419",
"@guardian/prettier": "^8.0.1",
"@guardian/shimport": "^1.0.2",
"@guardian/source-foundations": "16.0.0",
Expand Down
7 changes: 6 additions & 1 deletion static/src/javascripts/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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';

// 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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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: () => {},
},
],
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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-20250210165419"
"@guardian/prettier": "npm:^8.0.1"
"@guardian/shimport": "npm:^1.0.2"
"@guardian/source-foundations": "npm:16.0.0"
Expand Down Expand Up @@ -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-20250210165419":
version: 0.0.0-canary-20250210165419
resolution: "@guardian/libs@npm:0.0.0-canary-20250210165419"
peerDependencies:
tslib: ^2.6.2
typescript: ~5.5.2
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/0ab14266f3de53da978a60dc0bcbf09cf9f5350fe070dbfd858d1bfa55bf8e802c18513c579674777e9a69efb2b1f672b815eb7c81b98c97b993ac68f73bda3c
checksum: 10c0/443a02cbe748f297df690f41e4f19c80b17ddff614849a15902f9ed33aa4fd3853133107ccd07b56f4db34e43fa60c7c68e1cb94fa6f918a3945137a55942cba
languageName: node
linkType: hard

Expand Down
Loading