Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion ab-testing/config/abTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const ABTests: ABTest[] = [
status: "ON",
audienceSize: 0 / 100,
audienceSpace: "B",
groups: ["control", "variant"],
groups: ["control", "variant", "variant2"],
shouldForceMetricsCollection: true,
},
{
Expand Down
8 changes: 8 additions & 0 deletions dotcom-rendering/src/components/StickyBottomBanner.island.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const buildRRBannerConfigWith = ({
pageId,
inHoldbackGroup,
inAuxiaVariant,
inNoShowMobileAboveNavVariant,
}: {
isSignedIn: boolean;
countryCode: CountryCode;
Expand All @@ -144,6 +145,7 @@ const buildRRBannerConfigWith = ({
pageId?: string;
inHoldbackGroup?: boolean;
inAuxiaVariant?: boolean;
inNoShowMobileAboveNavVariant?: boolean;
}): CandidateConfig<ModuleData<BannerProps>> => {
return {
candidate: {
Expand Down Expand Up @@ -182,6 +184,7 @@ const buildRRBannerConfigWith = ({
pageId,
inHoldbackGroup,
inAuxiaVariant,
inNoShowMobileAboveNavVariant,
}),
show: ({ name, props }: ModuleData<BannerProps>) => (
<BannerComponent name={name} props={props} />
Expand Down Expand Up @@ -339,6 +342,11 @@ export const StickyBottomBanner = ({
'control',
) ?? false,
inAuxiaVariant,
inNoShowMobileAboveNavVariant:
abTests?.isUserInTestGroup(
'commercial-mobile-above-nav-test',
'variant2',
) ?? false,
Comment thread
oliverabrahams marked this conversation as resolved.
});
const brazeArticleContext: BrazeArticleContext = {
section: sectionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type BaseProps = {
pageId?: string;
inHoldbackGroup?: boolean;
inAuxiaVariant?: boolean;
inNoShowMobileAboveNavVariant?: boolean;
};

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

// the test includes the crossword pages (tag type/crossword) and the crosswords front (pageId === 'crosswords')
const isInMobileAboveNavTest = (
tags: TagType[],
renderingTarget: RenderingTarget,
pageId?: string,
): boolean => {
return (
(tags.some((tag) => tag.id === 'type/crossword') ||
pageId === 'crosswords') &&
renderingTarget === 'Web'
);
};

const getArticleCountToday = (
articleCounts: ArticleCounts | undefined,
): number | undefined => {
Expand Down Expand Up @@ -209,7 +223,15 @@ export const canShowRRBanner: CanShowFunctionType<
pageId,
inHoldbackGroup,
inAuxiaVariant,
inNoShowMobileAboveNavVariant,
}) => {
if (
inNoShowMobileAboveNavVariant === true &&
isInMobileAboveNavTest(tags, renderingTarget, pageId)
) {
return { show: false };
}

if (!remoteBannerConfig) {
return { show: false };
}
Expand Down
7 changes: 4 additions & 3 deletions dotcom-rendering/src/layouts/CrosswordLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { SubMeta } from '../components/SubMeta';
import { SubNav } from '../components/SubNav.island';
import { type ArticleFormat, ArticleSpecial } from '../lib/articleFormat';
import { canRenderAds } from '../lib/canRenderAds';
import { shouldShowMobileAboveNavSlot } from '../lib/commercialMobileAboveNavTest';
import { getContributionsServiceUrl } from '../lib/contributions';
import type { NavType } from '../model/extract-nav';
import { palette as themePalette } from '../palette';
Expand Down Expand Up @@ -139,11 +140,11 @@ export const CrosswordLayout = (props: Props) => {
shouldCenter={false}
>
<HeaderAdSlot
includeMobile={
includeMobile={shouldShowMobileAboveNavSlot(
article.config.serverSideABTests[
'commercial-mobile-above-nav-test'
] === 'variant'
}
],
)}
/>
</Section>
</div>
Expand Down
9 changes: 6 additions & 3 deletions dotcom-rendering/src/layouts/FrontLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
MAX_FRONTS_BANNER_ADS as maxDesktopAds,
MAX_FRONTS_MOBILE_ADS as maxMobileAds,
} from '../lib/commercial-constants';
import { shouldShowMobileAboveNavSlot } from '../lib/commercialMobileAboveNavTest';
import { getContributionsServiceUrl } from '../lib/contributions';
import { editionList } from '../lib/edition';
import {
Expand Down Expand Up @@ -218,9 +219,11 @@ export const FrontLayout = ({ front, NAV }: Props) => {
<HeaderAdSlot
includeMobile={
front.config.section === 'crosswords' &&
front.config.serverSideABTests[
'commercial-mobile-above-nav-test'
] === 'variant'
shouldShowMobileAboveNavSlot(
front.config.serverSideABTests[
'commercial-mobile-above-nav-test'
],
)
}
/>
</Section>
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/lib/commercialMobileAboveNavTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const shouldShowMobileAboveNavSlot = (testGroup?: string): boolean => {
return testGroup === 'variant' || testGroup === 'variant2';
};
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading