From 83fe063f3dd30d261ef879668b13090cb15ad81b Mon Sep 17 00:00:00 2001 From: Simon Adcock Date: Tue, 10 Feb 2026 14:00:21 +0000 Subject: [PATCH 1/2] roll out prefer variant of preferred source btn --- .../src/components/ArticleMeta.web.tsx | 15 ++-- .../PreferredSourceButton.stories.tsx | 18 +---- .../src/components/PreferredSourceButton.tsx | 22 +----- .../src/experiments/preferredSource.ts | 74 ------------------- dotcom-rendering/src/preferredSource.ts | 45 +++++++++++ 5 files changed, 55 insertions(+), 119 deletions(-) delete mode 100644 dotcom-rendering/src/experiments/preferredSource.ts create mode 100644 dotcom-rendering/src/preferredSource.ts diff --git a/dotcom-rendering/src/components/ArticleMeta.web.tsx b/dotcom-rendering/src/components/ArticleMeta.web.tsx index 7174dd76585..288f15c5726 100644 --- a/dotcom-rendering/src/components/ArticleMeta.web.tsx +++ b/dotcom-rendering/src/components/ArticleMeta.web.tsx @@ -2,7 +2,6 @@ import { css } from '@emotion/react'; import { between, from, space, until } from '@guardian/source/foundations'; import { StraightLines } from '@guardian/source-development-kitchen/react-components'; import type { CSSProperties } from 'react'; -import { preferredSourceExperiment } from '../experiments/preferredSource'; import type { FEArticle } from '../frontend/feArticle'; import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling'; import { @@ -13,8 +12,8 @@ import { } from '../lib/articleFormat'; import { getAudioData } from '../lib/audio-data'; import { getSoleContributor } from '../lib/byline'; -import { useBetaAB } from '../lib/useAB'; import { palette as themePalette } from '../palette'; +import { hasPreferredSourceButton } from '../preferredSource'; import type { Branding as BrandingType } from '../types/branding'; import type { FEElement } from '../types/content'; import type { Podcast, TagType } from '../types/tag'; @@ -343,12 +342,10 @@ export const ArticleMeta = ({ mainMediaElements, crossword, }: Props) => { - const abTests = useBetaAB(); const { renderingTarget } = useConfig(); - const preferredSource = preferredSourceExperiment( + const showPreferredSource = hasPreferredSourceButton( renderingTarget, format, - abTests, ); const soleContributor = getSoleContributor(tags, byline); const authorName = soleContributor?.title ?? 'Author Image'; @@ -446,7 +443,7 @@ export const ArticleMeta = ({
{renderingTarget === 'Web' && (
- {preferredSource.hasButton ? ( - - ) : null} + {showPreferredSource ? : null} ); diff --git a/dotcom-rendering/src/components/PreferredSourceButton.stories.tsx b/dotcom-rendering/src/components/PreferredSourceButton.stories.tsx index d099f3ee039..87aab2cee01 100644 --- a/dotcom-rendering/src/components/PreferredSourceButton.stories.tsx +++ b/dotcom-rendering/src/components/PreferredSourceButton.stories.tsx @@ -12,10 +12,7 @@ export default meta; type Story = StoryObj; -export const VariantA = { - args: { - kind: 'prefer', - }, +export const Default = { parameters: { chromatic: { modes: { @@ -24,16 +21,3 @@ export const VariantA = { }, }, } satisfies Story; - -export const VariantB = { - args: { - kind: 'add', - }, - parameters: { - chromatic: { - modes: { - 'vertical leftCol': allModes['vertical leftCol'], - }, - }, - }, -} satisfies Story; diff --git a/dotcom-rendering/src/components/PreferredSourceButton.tsx b/dotcom-rendering/src/components/PreferredSourceButton.tsx index 49bdf8e0084..8af7aceab19 100644 --- a/dotcom-rendering/src/components/PreferredSourceButton.tsx +++ b/dotcom-rendering/src/components/PreferredSourceButton.tsx @@ -6,21 +6,16 @@ import { textSans14Object, } from '@guardian/source/foundations'; import { LinkButton, SvgGoogleBrand } from '@guardian/source/react-components'; -import type { ButtonKind } from '../experiments/preferredSource'; import { palette } from '../palette'; -type Props = { - kind: ButtonKind; -}; - -export const PreferredSourceButton = ({ kind }: Props) => ( +export const PreferredSourceButton = () => ( } size="small" href="https://www.google.com/preferences/source?q=theguardian.com" - data-component={`preferred-source-button-${kind}`} - data-link-name={`preferred-source-button-${kind}`} + data-component={`preferred-source-button-prefer`} + data-link-name={`preferred-source-button-prefer`} cssOverrides={css({ ...textSans14Object, padding: '8px 12px 10px', @@ -52,15 +47,6 @@ export const PreferredSourceButton = ({ kind }: Props) => ( backgroundTertiaryHover: palette('--preferred-source-button-hover'), }} > - {copy(kind)} + {'Prefer the Guardian on Google'} ); - -const copy = (kind: Props['kind']): string => { - switch (kind) { - case 'prefer': - return 'Prefer the Guardian on Google'; - case 'add': - return 'Add the Guardian on Google'; - } -}; diff --git a/dotcom-rendering/src/experiments/preferredSource.ts b/dotcom-rendering/src/experiments/preferredSource.ts deleted file mode 100644 index f380eb58148..00000000000 --- a/dotcom-rendering/src/experiments/preferredSource.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - ArticleDesign, - type ArticleFormat, - ArticleSpecial, -} from '../lib/articleFormat'; -import type { RenderingTarget } from '../types/renderingTarget'; -import type { BetaABTestAPI } from './lib/beta-ab-tests'; - -type PreferredSourceExperiment = - | { - hasButton: true; - kind: ButtonKind; - } - | { - hasButton: false; - }; - -export type ButtonKind = 'prefer' | 'add'; - -export const preferredSourceExperiment = ( - renderingTarget: RenderingTarget, - format: ArticleFormat, - abTests: BetaABTestAPI | undefined, -): PreferredSourceExperiment => { - if (renderingTarget !== 'Web') { - return { hasButton: false }; - } - - switch (format.design) { - case ArticleDesign.Analysis: - case ArticleDesign.Audio: - case ArticleDesign.Comment: - case ArticleDesign.DeadBlog: - case ArticleDesign.Editorial: - case ArticleDesign.FullPageInteractive: - case ArticleDesign.Gallery: - case ArticleDesign.Interactive: - case ArticleDesign.Letter: - case ArticleDesign.LiveBlog: - case ArticleDesign.NewsletterSignup: - case ArticleDesign.Picture: - case ArticleDesign.Video: - return { hasButton: false }; - default: - break; - } - - switch (format.theme) { - case ArticleSpecial.Labs: - case ArticleSpecial.SpecialReport: - case ArticleSpecial.SpecialReportAlt: - return { hasButton: false }; - default: - break; - } - - const group = abTests?.getParticipations()['webex-preferred-source']; - - switch (group) { - case 'prefer': - return { - hasButton: true, - kind: 'prefer', - }; - case 'add': - return { - hasButton: true, - kind: 'add', - }; - case 'control': - default: - return { hasButton: false }; - } -}; diff --git a/dotcom-rendering/src/preferredSource.ts b/dotcom-rendering/src/preferredSource.ts new file mode 100644 index 00000000000..ae910a83426 --- /dev/null +++ b/dotcom-rendering/src/preferredSource.ts @@ -0,0 +1,45 @@ +import { + ArticleDesign, + type ArticleFormat, + ArticleSpecial, +} from './lib/articleFormat'; +import type { RenderingTarget } from './types/renderingTarget'; + +export const hasPreferredSourceButton = ( + renderingTarget: RenderingTarget, + format: ArticleFormat, +): boolean => { + if (renderingTarget !== 'Web') { + return false; + } + + switch (format.design) { + case ArticleDesign.Analysis: + case ArticleDesign.Audio: + case ArticleDesign.Comment: + case ArticleDesign.DeadBlog: + case ArticleDesign.Editorial: + case ArticleDesign.FullPageInteractive: + case ArticleDesign.Gallery: + case ArticleDesign.Interactive: + case ArticleDesign.Letter: + case ArticleDesign.LiveBlog: + case ArticleDesign.NewsletterSignup: + case ArticleDesign.Picture: + case ArticleDesign.Video: + return false; + default: + break; + } + + switch (format.theme) { + case ArticleSpecial.Labs: + case ArticleSpecial.SpecialReport: + case ArticleSpecial.SpecialReportAlt: + return false; + default: + break; + } + + return true; +}; From aac756f29c830bb0f5efccb51c32da0f9bd30d6e Mon Sep 17 00:00:00 2001 From: Simon Adcock Date: Tue, 10 Feb 2026 14:00:41 +0000 Subject: [PATCH 2/2] remove preferred source button test --- ab-testing/config/abTests.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/ab-testing/config/abTests.ts b/ab-testing/config/abTests.ts index c00baa09599..c0da7752312 100644 --- a/ab-testing/config/abTests.ts +++ b/ab-testing/config/abTests.ts @@ -81,18 +81,6 @@ const ABTests: ABTest[] = [ groups: ["true"], shouldForceMetricsCollection: false, }, - { - name: "webex-preferred-source", - description: - "Testing the Preferred Source on Google button in the meta section of articles", - owners: ["dotcom.platform@theguardian.com"], - expirationDate: "2026-02-25", - type: "server", - status: "ON", - audienceSize: 20 / 100, - audienceSpace: "A", - groups: ["control", "prefer", "add"], - }, { name: "commercial-mobile-inline1-halfpage", description: