Skip to content

Commit c178017

Browse files
add variant 2 for mobile above nav test. without the RR StickyBottomBanner
1 parent 9680460 commit c178017

7 files changed

Lines changed: 57 additions & 20 deletions

File tree

ab-testing/config/abTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const ABTests: ABTest[] = [
215215
status: "ON",
216216
audienceSize: 0 / 100,
217217
audienceSpace: "B",
218-
groups: ["control", "variant"],
218+
groups: ["control", "variant", "variant2"],
219219
shouldForceMetricsCollection: true,
220220
},
221221
{

dotcom-rendering/src/components/StickyBottomBanner.island.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const buildRRBannerConfigWith = ({
125125
pageId,
126126
inHoldbackGroup,
127127
inAuxiaVariant,
128+
inNoShowMobileAboveNavVariant,
128129
}: {
129130
isSignedIn: boolean;
130131
countryCode: CountryCode;
@@ -144,6 +145,7 @@ const buildRRBannerConfigWith = ({
144145
pageId?: string;
145146
inHoldbackGroup?: boolean;
146147
inAuxiaVariant?: boolean;
148+
inNoShowMobileAboveNavVariant?: boolean;
147149
}): CandidateConfig<ModuleData<BannerProps>> => {
148150
return {
149151
candidate: {
@@ -182,6 +184,7 @@ const buildRRBannerConfigWith = ({
182184
pageId,
183185
inHoldbackGroup,
184186
inAuxiaVariant,
187+
inNoShowMobileAboveNavVariant,
185188
}),
186189
show: ({ name, props }: ModuleData<BannerProps>) => (
187190
<BannerComponent name={name} props={props} />
@@ -339,6 +342,11 @@ export const StickyBottomBanner = ({
339342
'control',
340343
) ?? false,
341344
inAuxiaVariant,
345+
inNoShowMobileAboveNavVariant:
346+
abTests?.isUserInTestGroup(
347+
'commercial-mobile-above-nav-test',
348+
'variant2',
349+
) ?? false,
342350
});
343351
const brazeArticleContext: BrazeArticleContext = {
344352
section: sectionId,

dotcom-rendering/src/components/StickyBottomBanner/ReaderRevenueBanner.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type BaseProps = {
5252
pageId?: string;
5353
inHoldbackGroup?: boolean;
5454
inAuxiaVariant?: boolean;
55+
inNoShowMobileAboveNavVariant?: boolean;
5556
};
5657

5758
type BuildPayloadProps = BaseProps & {
@@ -76,6 +77,19 @@ export type CanShowFunctionType<T> = (
7677
props: CanShowProps,
7778
) => Promise<CanShowResult<T>>;
7879

80+
// the test includes the crossword pages (tag type/crossword) and the crosswords front (pageId === 'crosswords')
81+
const isInMobileAboveNavTest = (
82+
tags: TagType[],
83+
renderingTarget: RenderingTarget,
84+
pageId?: string,
85+
): boolean => {
86+
return (
87+
(tags.some((tag) => tag.id === 'type/crossword') ||
88+
pageId === 'crosswords') &&
89+
renderingTarget === 'Web'
90+
);
91+
};
92+
7993
const getArticleCountToday = (
8094
articleCounts: ArticleCounts | undefined,
8195
): number | undefined => {
@@ -209,7 +223,15 @@ export const canShowRRBanner: CanShowFunctionType<
209223
pageId,
210224
inHoldbackGroup,
211225
inAuxiaVariant,
226+
inNoShowMobileAboveNavVariant,
212227
}) => {
228+
if (
229+
inNoShowMobileAboveNavVariant === true &&
230+
isInMobileAboveNavTest(tags, renderingTarget, pageId)
231+
) {
232+
return { show: false };
233+
}
234+
213235
if (!remoteBannerConfig) {
214236
return { show: false };
215237
}

dotcom-rendering/src/layouts/CrosswordLayout.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { SubMeta } from '../components/SubMeta';
3131
import { SubNav } from '../components/SubNav.island';
3232
import { type ArticleFormat, ArticleSpecial } from '../lib/articleFormat';
3333
import { canRenderAds } from '../lib/canRenderAds';
34+
import { shouldShowMobileAboveNavSlot } from '../lib/commercialMobileAboveNavTest';
3435
import { getContributionsServiceUrl } from '../lib/contributions';
3536
import type { NavType } from '../model/extract-nav';
3637
import { palette as themePalette } from '../palette';
@@ -139,11 +140,11 @@ export const CrosswordLayout = (props: Props) => {
139140
shouldCenter={false}
140141
>
141142
<HeaderAdSlot
142-
includeMobile={
143+
includeMobile={shouldShowMobileAboveNavSlot(
143144
article.config.serverSideABTests[
144145
'commercial-mobile-above-nav-test'
145-
] === 'variant'
146-
}
146+
],
147+
)}
147148
/>
148149
</Section>
149150
</div>

dotcom-rendering/src/layouts/FrontLayout.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
MAX_FRONTS_BANNER_ADS as maxDesktopAds,
3636
MAX_FRONTS_MOBILE_ADS as maxMobileAds,
3737
} from '../lib/commercial-constants';
38+
import { shouldShowMobileAboveNavSlot } from '../lib/commercialMobileAboveNavTest';
3839
import { getContributionsServiceUrl } from '../lib/contributions';
3940
import { editionList } from '../lib/edition';
4041
import {
@@ -218,9 +219,11 @@ export const FrontLayout = ({ front, NAV }: Props) => {
218219
<HeaderAdSlot
219220
includeMobile={
220221
front.config.section === 'crosswords' &&
221-
front.config.serverSideABTests[
222-
'commercial-mobile-above-nav-test'
223-
] === 'variant'
222+
shouldShowMobileAboveNavSlot(
223+
front.config.serverSideABTests[
224+
'commercial-mobile-above-nav-test'
225+
],
226+
)
224227
}
225228
/>
226229
</Section>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const shouldShowMobileAboveNavSlot = (testGroup?: string): boolean => {
2+
return testGroup === 'variant' || testGroup === 'variant2';
3+
};

pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)