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

Deeply read right ab test #1365

Merged
merged 6 commits into from
May 16, 2024
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
5 changes: 5 additions & 0 deletions .changeset/afraid-nails-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/commercial': minor
---

Add Deeply Read 0% AB test
2 changes: 2 additions & 0 deletions src/experiments/ab-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ABTest } from '@guardian/ab-core';
import { deeplyReadRightColumn } from './tests/deeply-read-right-column';
import { mpuWhenNoEpic } from './tests/mpu-when-no-epic';

/**
Expand All @@ -9,4 +10,5 @@ import { mpuWhenNoEpic } from './tests/mpu-when-no-epic';
export const concurrentTests: readonly ABTest[] = [
// one test per line
mpuWhenNoEpic,
deeplyReadRightColumn,
];
35 changes: 35 additions & 0 deletions src/experiments/tests/deeply-read-right-column.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { ABTest } from '@guardian/ab-core';

export const deeplyReadRightColumn: ABTest = {
id: 'DeeplyReadRightColumn',
author: '@dotcom-platform',
start: '2024-04-30',
expiry: '2024-07-31',
audience: 0 / 100,
audienceOffset: 0 / 100,
audienceCriteria: '',
successMeasure: 'Improved click though rate',
description:
'Test the impact of adding deeply read component to the right column.',
variants: [
{
id: 'most-viewed-only',
test: (): void => {
/* no-op */
},
},
{
id: 'deeply-read-and-most-viewed',
test: (): void => {
/* no-op */
},
},
{
id: 'deeply-read-only',
test: (): void => {
/* no-op */
},
},
],
canRun: () => true,
};
22 changes: 19 additions & 3 deletions src/insert/spacefinder/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
getCurrentBreakpoint,
getCurrentTweakpoint,
} from 'lib/detect/detect-breakpoint';
import { isInVariantSynchronous } from '../../experiments/ab';
import { deeplyReadRightColumn } from '../../experiments/tests/deeply-read-right-column';
import { waitForAdvert } from '../../lib/dfp/wait-for-advert';
import fastdom from '../../utils/fastdom-promise';
import { computeStickyHeights, insertHeightStyles } from '../sticky-inlines';
Expand All @@ -25,6 +27,14 @@ import { isInHighValueSection } from './utils';

type SlotName = Parameters<typeof createAdSlot>[0];

/**
* As estimation of the height of the most viewed island.
* This appears from desktop breakpoints on the right-hand side.
* Knowing the height of the element is useful when
* calculating where to place ads in the right column.
*/
const MOST_VIEWED_HEIGHT = 600;

const articleBodySelector = '.article-body-commercial-selector';

const isPaidContent = window.guardian.config.page.isPaidContent;
Expand All @@ -34,6 +44,11 @@ const hasImages = !!window.guardian.config.page.lightboxImages?.images.length;
const hasShowcaseMainElement =
window.guardian.config.page.hasShowcaseMainElement;

const isInDeeplyReadMostViewedVariant = isInVariantSynchronous(
deeplyReadRightColumn,
'deeply-read-and-most-viewed',
);

const minDistanceBetweenRightRailAds = 500;
const minDistanceBetweenInlineAds = isInHighValueSection ? 500 : 750;

Expand Down Expand Up @@ -209,11 +224,12 @@ const addDesktopRightRailAds = (fillSlot: FillAdSlot): Promise<boolean> => {

/**
* In special cases, inline2 can overlap the "Most viewed" island, so
* we need to make an adjustment to move the inline2 further down the page.
* we need to make an adjustment to move the inline2 further down the page
*/
if (isPaidContent) {
minAbove += 600;
if (isInDeeplyReadMostViewedVariant || isPaidContent) {
minAbove += MOST_VIEWED_HEIGHT;
}

// Some old articles don't have a main image, which means the first paragraph is much higher
if (!hasImages) {
minAbove += 600;
Expand Down
Loading