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

Landing Page : abtest benefits reset - reset to control #6738

Merged
merged 4 commits into from
Jan 28, 2025
Merged
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
24 changes: 0 additions & 24 deletions support-frontend/assets/helpers/abTests/abtestDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,4 @@ export const tests: Tests = {
targetPage: pageUrlRegexes.contributions.allLandingPagesAndThankyouPages,
excludeContributionsOnlyCountries: true,
},
benefitsReset: {
variants: [
{
id: 'control',
},
{
id: 'v1',
},
{
id: 'v2',
},
],
audiences: {
ALL: {
offset: 0,
size: 1,
},
},
isActive: true,
referrerControlled: false, // ab-test name not needed to be in paramURL
seed: 4,
targetPage: pageUrlRegexes.contributions.allLandingPagesAndThankyouPages,
excludeContributionsOnlyCountries: true,
},
};
93 changes: 6 additions & 87 deletions support-frontend/assets/helpers/productCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ export type { ActiveProductKey };

export const productCatalog = window.guardian.productCatalog;

type SupporterPlusVariants = 'control' | 'v1' | 'v2';
type ContributionVariants = 'control' | 'v1' | 'v2Annual' | 'v2Monthly';

type ProductBenefit = {
copy: string;
tooltip?: string;
Expand Down Expand Up @@ -97,31 +94,16 @@ export function isProductKey(val: unknown): val is ActiveProductKey {
return productKeys.includes(val as ActiveProductKey);
}

const appBenefitControlV2 = {
copy: 'Unlimited access to the Guardian app',
tooltip: `Read beyond our 20 article-per-month limit, enjoy offline access and personalised recommendations, and access our full archive of journalism. Never miss a story with the Guardian News app – a beautiful, intuitive reading experience.`,
};
const appBenefit = {
copy: 'Full access to the Guardian app',
copy: 'Unlimited access to the Guardian app',
tooltip: `Read beyond our 20 article-per-month limit, enjoy offline access and personalised recommendations, and access our full archive of journalism. Never miss a story with the Guardian News app – a beautiful, intuitive reading experience.`,
};
const addFreeBenefit = {
copy: 'Ad-free reading on all your devices',
};

const newsletterBenefitControl = {
copy: 'Exclusive newsletter for supporters, sent every week from the Guardian newsroom',
};
const newsletterBenefit = {
copy: 'Regular dispatches from the newsroom to see the impact of your support',
};
const newsletterBenefitMonthlyV2 = {
copy: 'Give to the Guardian every month with Support',
hideBullet: true,
};
const newsletterBenefitAnnualV2 = {
copy: 'Give to the Guardian every year with Support',
hideBullet: true,
copy: 'Exclusive newsletter for supporters, sent every week from the Guardian newsroom',
};
const fewerAsksBenefit = {
copy: 'Far fewer asks for support',
Expand Down Expand Up @@ -156,42 +138,13 @@ const feastBenefit = {
};

const supporterPlusBenefits = [
fewerAsksBenefit,
newsletterBenefit,
addFreeBenefit,
appBenefit,
addFreeBenefit,
newsletterBenefit,
fewerAsksBenefit,
partnerOffersBenefit,
feastBenefit,
];
const supporterPlusBenefitsList: Record<
SupporterPlusVariants,
ProductBenefit[]
> = {
control: [
appBenefitControlV2,
addFreeBenefit,
newsletterBenefitControl,
fewerAsksBenefit,
partnerOffersBenefit,
feastBenefit,
],
v1: supporterPlusBenefits,
v2: [
appBenefitControlV2,
addFreeBenefit,
fewerAsksBenefit,
partnerOffersBenefit,
feastBenefit,
],
};

const contributionBenefitsList: Record<ContributionVariants, ProductBenefit[]> =
{
control: [newsletterBenefitControl],
v1: [newsletterBenefit],
v2Monthly: [newsletterBenefitMonthlyV2],
v2Annual: [newsletterBenefitAnnualV2],
};

const tierThreeBenefits = [guardianWeeklyBenefit];
const tierThreeInclArchiveBenefitsUK = [
Expand Down Expand Up @@ -460,32 +413,7 @@ export const productCatalogDescription: Record<
},
};

function supporterPlusVariant(variant?: string): SupporterPlusVariants {
switch (variant) {
case 'v1':
case 'v2':
return variant;
default:
return 'control';
}
}
function contributionVariant(
period: 'Monthly' | 'Annual',
variant?: string,
): ContributionVariants {
switch (variant) {
case 'v1':
return variant;
case 'v2':
return `v2${period}`;
default:
return 'control';
}
}

export function productCatalogDescriptionResetAndNewspaperArchive(
period: 'Monthly' | 'Annual',
resetVariant?: string,
export function productCatalogDescriptionNewspaperArchive(
countryGroupId?: CountryGroupId,
) {
const newsPaperArchiveBenefit = countryGroupId
Expand All @@ -496,15 +424,6 @@ export function productCatalogDescriptionResetAndNewspaperArchive(

return {
...productCatalogDescription,
SupporterPlus: {
...productCatalogDescription.SupporterPlus,
benefits: supporterPlusBenefitsList[supporterPlusVariant(resetVariant)],
},
Contribution: {
...productCatalogDescription.Contribution,
benefits:
contributionBenefitsList[contributionVariant(period, resetVariant)],
},
TierThree: {
...productCatalogDescription.TierThree,
benefits: newsPaperArchiveBenefit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
import { currencies } from 'helpers/internationalisation/currency';
import {
productCatalog,
productCatalogDescriptionResetAndNewspaperArchive,
productCatalogDescriptionNewspaperArchive,
} from 'helpers/productCatalog';
import type { BillingPeriod } from 'helpers/productPrice/billingPeriods';
import type { Promotion } from 'helpers/productPrice/promotions';
Expand Down Expand Up @@ -373,16 +373,12 @@ export function ThreeTierLanding({
const selectedContributionRatePlan =
contributionType === 'ANNUAL' ? 'Annual' : 'Monthly';

const inResetBenefits = abParticipations.benefitsReset; // all variants
const inNewsPaperArchiveBenefit = ['v1', 'v2'].includes(
abParticipations.newspaperArchiveBenefit ?? '',
);
const productCatalogDescription =
productCatalogDescriptionResetAndNewspaperArchive(
selectedContributionRatePlan,
inResetBenefits,
inNewsPaperArchiveBenefit ? countryGroupId : undefined,
);
const productCatalogDescription = productCatalogDescriptionNewspaperArchive(
inNewsPaperArchiveBenefit ? countryGroupId : undefined,
);

/**
* Tier 1: Contributions
Expand Down Expand Up @@ -452,9 +448,7 @@ export function ThreeTierLanding({
urlSearchParamsProduct === 'SupporterPlus' ||
isCardUserSelected(tier2Pricing, promotionTier2?.discount?.amount),
ctaCopy: 'Support',
lozengeText: ['control', 'v2'].includes(inResetBenefits ?? '')
? 'Recommended'
: 'Highest impact',
lozengeText: 'Recommended',
};

/**
Expand Down