Skip to content

Commit c3e0c1d

Browse files
authored
Merge pull request #15328 from guardian/sa-preferred-source-100
Roll out Google Preferred Source button to 100% of audience
2 parents 90ba964 + aac756f commit c3e0c1d

6 files changed

Lines changed: 55 additions & 131 deletions

File tree

ab-testing/config/abTests.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,6 @@ const ABTests: ABTest[] = [
8181
groups: ["true"],
8282
shouldForceMetricsCollection: false,
8383
},
84-
{
85-
name: "webex-preferred-source",
86-
description:
87-
"Testing the Preferred Source on Google button in the meta section of articles",
88-
owners: ["dotcom.platform@theguardian.com"],
89-
expirationDate: "2026-02-25",
90-
type: "server",
91-
status: "ON",
92-
audienceSize: 20 / 100,
93-
audienceSpace: "A",
94-
groups: ["control", "prefer", "add"],
95-
},
9684
{
9785
name: "commercial-mobile-inline1-halfpage",
9886
description:

dotcom-rendering/src/components/ArticleMeta.web.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { css } from '@emotion/react';
22
import { between, from, space, until } from '@guardian/source/foundations';
33
import { StraightLines } from '@guardian/source-development-kitchen/react-components';
44
import type { CSSProperties } from 'react';
5-
import { preferredSourceExperiment } from '../experiments/preferredSource';
65
import type { FEArticle } from '../frontend/feArticle';
76
import { interactiveLegacyClasses } from '../layouts/lib/interactiveLegacyStyling';
87
import {
@@ -13,8 +12,8 @@ import {
1312
} from '../lib/articleFormat';
1413
import { getAudioData } from '../lib/audio-data';
1514
import { getSoleContributor } from '../lib/byline';
16-
import { useBetaAB } from '../lib/useAB';
1715
import { palette as themePalette } from '../palette';
16+
import { hasPreferredSourceButton } from '../preferredSource';
1817
import type { Branding as BrandingType } from '../types/branding';
1918
import type { FEElement } from '../types/content';
2019
import type { Podcast, TagType } from '../types/tag';
@@ -343,12 +342,10 @@ export const ArticleMeta = ({
343342
mainMediaElements,
344343
crossword,
345344
}: Props) => {
346-
const abTests = useBetaAB();
347345
const { renderingTarget } = useConfig();
348-
const preferredSource = preferredSourceExperiment(
346+
const showPreferredSource = hasPreferredSourceButton(
349347
renderingTarget,
350348
format,
351-
abTests,
352349
);
353350
const soleContributor = getSoleContributor(tags, byline);
354351
const authorName = soleContributor?.title ?? 'Author Image';
@@ -446,7 +443,7 @@ export const ArticleMeta = ({
446443
<div
447444
data-print-layout="hide"
448445
css={metaFlex}
449-
style={preferredSourceMetaFlex(preferredSource.hasButton)}
446+
style={preferredSourceMetaFlex(showPreferredSource)}
450447
>
451448
{renderingTarget === 'Web' && (
452449
<div
@@ -464,7 +461,7 @@ export const ArticleMeta = ({
464461
),
465462
]}
466463
style={preferredSourceMetaExtras(
467-
preferredSource.hasButton,
464+
showPreferredSource,
468465
)}
469466
>
470467
<Island
@@ -518,9 +515,7 @@ export const ArticleMeta = ({
518515
</div>
519516
</div>
520517
</div>
521-
{preferredSource.hasButton ? (
522-
<PreferredSourceButton kind={preferredSource.kind} />
523-
) : null}
518+
{showPreferredSource ? <PreferredSourceButton /> : null}
524519
</div>
525520
</div>
526521
);

dotcom-rendering/src/components/PreferredSourceButton.stories.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export default meta;
1212

1313
type Story = StoryObj<typeof meta>;
1414

15-
export const VariantA = {
16-
args: {
17-
kind: 'prefer',
18-
},
15+
export const Default = {
1916
parameters: {
2017
chromatic: {
2118
modes: {
@@ -24,16 +21,3 @@ export const VariantA = {
2421
},
2522
},
2623
} satisfies Story;
27-
28-
export const VariantB = {
29-
args: {
30-
kind: 'add',
31-
},
32-
parameters: {
33-
chromatic: {
34-
modes: {
35-
'vertical leftCol': allModes['vertical leftCol'],
36-
},
37-
},
38-
},
39-
} satisfies Story;

dotcom-rendering/src/components/PreferredSourceButton.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,16 @@ import {
66
textSans14Object,
77
} from '@guardian/source/foundations';
88
import { LinkButton, SvgGoogleBrand } from '@guardian/source/react-components';
9-
import type { ButtonKind } from '../experiments/preferredSource';
109
import { palette } from '../palette';
1110

12-
type Props = {
13-
kind: ButtonKind;
14-
};
15-
16-
export const PreferredSourceButton = ({ kind }: Props) => (
11+
export const PreferredSourceButton = () => (
1712
<LinkButton
1813
priority="tertiary"
1914
icon={<SvgGoogleBrand />}
2015
size="small"
2116
href="https://www.google.com/preferences/source?q=theguardian.com"
22-
data-component={`preferred-source-button-${kind}`}
23-
data-link-name={`preferred-source-button-${kind}`}
17+
data-component={`preferred-source-button-prefer`}
18+
data-link-name={`preferred-source-button-prefer`}
2419
cssOverrides={css({
2520
...textSans14Object,
2621
padding: '8px 12px 10px',
@@ -52,15 +47,6 @@ export const PreferredSourceButton = ({ kind }: Props) => (
5247
backgroundTertiaryHover: palette('--preferred-source-button-hover'),
5348
}}
5449
>
55-
{copy(kind)}
50+
{'Prefer the Guardian on Google'}
5651
</LinkButton>
5752
);
58-
59-
const copy = (kind: Props['kind']): string => {
60-
switch (kind) {
61-
case 'prefer':
62-
return 'Prefer the Guardian on Google';
63-
case 'add':
64-
return 'Add the Guardian on Google';
65-
}
66-
};

dotcom-rendering/src/experiments/preferredSource.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {
2+
ArticleDesign,
3+
type ArticleFormat,
4+
ArticleSpecial,
5+
} from './lib/articleFormat';
6+
import type { RenderingTarget } from './types/renderingTarget';
7+
8+
export const hasPreferredSourceButton = (
9+
renderingTarget: RenderingTarget,
10+
format: ArticleFormat,
11+
): boolean => {
12+
if (renderingTarget !== 'Web') {
13+
return false;
14+
}
15+
16+
switch (format.design) {
17+
case ArticleDesign.Analysis:
18+
case ArticleDesign.Audio:
19+
case ArticleDesign.Comment:
20+
case ArticleDesign.DeadBlog:
21+
case ArticleDesign.Editorial:
22+
case ArticleDesign.FullPageInteractive:
23+
case ArticleDesign.Gallery:
24+
case ArticleDesign.Interactive:
25+
case ArticleDesign.Letter:
26+
case ArticleDesign.LiveBlog:
27+
case ArticleDesign.NewsletterSignup:
28+
case ArticleDesign.Picture:
29+
case ArticleDesign.Video:
30+
return false;
31+
default:
32+
break;
33+
}
34+
35+
switch (format.theme) {
36+
case ArticleSpecial.Labs:
37+
case ArticleSpecial.SpecialReport:
38+
case ArticleSpecial.SpecialReportAlt:
39+
return false;
40+
default:
41+
break;
42+
}
43+
44+
return true;
45+
};

0 commit comments

Comments
 (0)