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

Remove Section Fronts AB test #9114

Merged
merged 3 commits into from
Oct 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,6 @@ export const Standard = {
serverSideLiveblogInlineAds: true,
discussionPageSize: true,
smartAppBanner: false,
sectionFrontsBannerAds: true,
abPrebidKargo: true,
boostGaUserTimingFidelity: false,
historyTags: true,
Expand Down
50 changes: 14 additions & 36 deletions dotcom-rendering/src/layouts/FrontLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ import { WeatherWrapper } from '../components/WeatherWrapper.importable';
import { canRenderAds } from '../lib/canRenderAds';
import { getContributionsServiceUrl } from '../lib/contributions';
import { decideContainerOverrides } from '../lib/decideContainerOverrides';
import {
networkFrontsBannerAdCollections,
sectionFrontsBannerAdCollections,
} from '../lib/frontsBannerAbTestAdPositions';
import { frontsBannerAdCollections } from '../lib/frontsBannerAbTestAdPositions';
import {
getDesktopAdPositions,
getMerchHighPosition,
Expand Down Expand Up @@ -89,8 +86,7 @@ export const decideAdSlot = (
isPaidContent: boolean | undefined,
mobileAdPositions: (number | undefined)[],
hasPageSkin: boolean,
isInNetworkFrontsBannerTest?: boolean,
isInSectionFrontsBannerTest?: boolean,
isInFrontsBannerTest?: boolean,
) => {
if (!renderAds) return null;

Expand All @@ -99,7 +95,7 @@ export const decideAdSlot = (
collectionCount > minContainers &&
index === getMerchHighPosition(collectionCount)
) {
if (isInNetworkFrontsBannerTest || isInSectionFrontsBannerTest) {
if (isInFrontsBannerTest) {
return (
<Hide from="desktop">
<AdSlot
Expand Down Expand Up @@ -219,24 +215,14 @@ export const FrontLayout = ({ front, NAV }: Props) => {

const hasPageSkin = hasPageSkinConfig && renderAds;

const isInNetworkFrontsBannerTest =
const isInFrontsBannerTest =
!!switches.frontsBannerAdsDcr &&
abTests.frontsBannerAdsDcrVariant === 'variant' &&
Object.keys(networkFrontsBannerAdCollections).includes(
front.config.pageId,
);
const isInSectionFrontsBannerTest =
!!switches.sectionFrontsBannerAds &&
abTests.sectionFrontsBannerAdsVariant === 'variant' &&
Object.keys(sectionFrontsBannerAdCollections).includes(
front.config.pageId,
);
Object.keys(frontsBannerAdCollections).includes(front.config.pageId);

// This will be the targeted collections, if the current page is in the fronts banner AB test.
const frontsBannerTargetedCollections = isInNetworkFrontsBannerTest
? networkFrontsBannerAdCollections[front.config.pageId]
: isInSectionFrontsBannerTest
? sectionFrontsBannerAdCollections[front.config.pageId]
// This will be the targeted collections if the current page is in the fronts banner AB test.
const frontsBannerTargetedCollections = isInFrontsBannerTest
? frontsBannerAdCollections[front.config.pageId]
: [];

const merchHighPosition = getMerchHighPosition(
Expand All @@ -253,10 +239,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {

const numBannerAdsInserted = useRef(0);

const renderMpuAds =
renderAds &&
!isInNetworkFrontsBannerTest &&
!isInSectionFrontsBannerTest;
const renderMpuAds = renderAds && !isInFrontsBannerTest;

const showMostPopular =
front.config.switches.deeplyRead &&
Expand Down Expand Up @@ -497,8 +480,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
.isPaidContent,
mobileAdPositions,
hasPageSkin,
isInNetworkFrontsBannerTest,
isInSectionFrontsBannerTest,
isInFrontsBannerTest,
)}
</div>
</Fragment>
Expand Down Expand Up @@ -577,8 +559,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
.isPaidContent,
mobileAdPositions,
hasPageSkin,
isInNetworkFrontsBannerTest,
isInSectionFrontsBannerTest,
isInFrontsBannerTest,
)}
</>
);
Expand Down Expand Up @@ -632,8 +613,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
.isPaidContent,
mobileAdPositions,
hasPageSkin,
isInNetworkFrontsBannerTest,
isInSectionFrontsBannerTest,
isInFrontsBannerTest,
)}
</Fragment>
);
Expand Down Expand Up @@ -715,8 +695,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
.isPaidContent,
mobileAdPositions,
hasPageSkin,
isInNetworkFrontsBannerTest,
isInSectionFrontsBannerTest,
isInFrontsBannerTest,
)}
</Fragment>
);
Expand Down Expand Up @@ -800,8 +779,7 @@ export const FrontLayout = ({ front, NAV }: Props) => {
front.pressedPage.frontProperties.isPaidContent,
mobileAdPositions,
hasPageSkin,
isInNetworkFrontsBannerTest,
isInSectionFrontsBannerTest,
isInFrontsBannerTest,
)}
</Fragment>
);
Expand Down
5 changes: 1 addition & 4 deletions dotcom-rendering/src/lib/frontsBannerAbTestAdPositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type FrontsBannerAdCollections = {
[key: string]: string[];
};

export const networkFrontsBannerAdCollections: FrontsBannerAdCollections = {
export const frontsBannerAdCollections: FrontsBannerAdCollections = {
uk: [
'Spotlight',
'Opinion',
Expand Down Expand Up @@ -49,9 +49,6 @@ export const networkFrontsBannerAdCollections: FrontsBannerAdCollections = {
'Around the world',
'Take part',
],
};

export const sectionFrontsBannerAdCollections: FrontsBannerAdCollections = {
'uk/sport': [
'News and features',
// 'football', has football weekly thrasher above atm
Expand Down
Loading