Skip to content

Commit

Permalink
Merge pull request #9114 from guardian/doml/remove-section-fronts-ab-…
Browse files Browse the repository at this point in the history
…test

Remove Section Fronts AB test
  • Loading branch information
domlander authored Oct 12, 2023
2 parents a0134d0 + fbc72a9 commit cebb395
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 41 deletions.
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

0 comments on commit cebb395

Please sign in to comment.