Skip to content

Commit 14efc6e

Browse files
authored
Merge pull request #13708 from guardian/ei/prevent-ads-before-labs
Prevent mobile front ads from being placed before a labs container
2 parents 8f10440 + 3ee0765 commit 14efc6e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dotcom-rendering/src/lib/getFrontsAdPositions.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type GroupedCounts = {
1717

1818
export type AdCandidateMobile = Pick<
1919
DCRCollectionType,
20-
'collectionType' | 'containerLevel'
20+
'collectionType' | 'containerLevel' | 'containerPalette'
2121
>;
2222

2323
/** The Merch high slot is directly before the most viewed container */
@@ -41,6 +41,11 @@ const isMerchHighPosition = (
4141
const isBeforeThrasher = (index: number, collections: AdCandidateMobile[]) =>
4242
collections[index + 1]?.collectionType === 'fixed/thrasher';
4343

44+
const isBeforeBrandedContainer = (
45+
index: number,
46+
collections: AdCandidateMobile[],
47+
) => collections[index + 1]?.containerPalette === 'Branded';
48+
4449
const isMostViewedContainer = (collection: AdCandidateMobile) =>
4550
collection.collectionType === 'news/most-popular';
4651

@@ -88,6 +93,8 @@ const canInsertMobileAd =
8893
// Allow insertion after first container at any time but for all other situations,
8994
// prevent insertion before a secondary level container
9095
index === 0 || !isBeforeSecondaryLevelContainer(index, collections),
96+
// Prevent insertion before a branded container
97+
!isBeforeBrandedContainer(index, collections),
9198
];
9299

93100
// Ad insertion is possible if every condition is met

0 commit comments

Comments
 (0)