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

Add slot targeting to indicate teads eligibility #1603

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

emma-imber
Copy link
Contributor

What does this change?

Adds slot level targeting to add a key word to indicate if a slot is eligible for teads or not. The checks in this diagram have been implemented as code checks to reduce the logic we need to add in GAM.

image (2)

Why?

At the moment a lot of targeting needs to be added in GAM to determine slots which are eligible for teads. It's complex to set up ads in GAM so that they don't target slots which are eligible for teads. By adding a specific key word we can simplify the targeting set up for teads in GAM.

@emma-imber emma-imber requested a review from a team as a code owner September 30, 2024 15:05
Copy link

changeset-bot bot commented Sep 30, 2024

🦋 Changeset detected

Latest commit: d0c49a0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@guardian/commercial Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Sep 30, 2024

Ad load time test results

For consented, top-above-nav took on average 4938ms to load.
For consentless, top-above-nav took on average 3017ms to load.

Test conditions:

  • 5mbps download speed
  • 1.5mbps upload speed
  • 150ms latency

Copy link
Contributor

@deedeeh deedeeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great Emma ✨ I really enjoyed reading your clean code! It's great to avoid GAM configuration and setup as much as we could 👏🏼

];

const isEligibleForTeads = (slotId: string) => {
const { page } = window.guardian.config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:

Suggested change
const { page } = window.guardian.config;
const { contentType, pageId, isSensitive } = window.guardian.config.page;

Comment on lines 140 to 142
const instancesOfBannedKeywords = urlKeywords.filter((keyword) =>
bannedUrlKeywords.includes(keyword),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:

Suggested change
const instancesOfBannedKeywords = urlKeywords.filter((keyword) =>
bannedUrlKeywords.includes(keyword),
);
const hasBannedKeywords: boolean = urlKeywords.some((keyword) =>
bannedUrlKeywords.includes(keyword),
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hadn't seen this before - definitely neater, thanks!

Comment on lines 145 to 149
if (isEligibleForTeads(adSlotNode.id)) {
slotTargeting['teadsEligible'] = 'true';
} else {
slotTargeting['teadsEligible'] = 'false';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most other slot targeting is set in defineSlot might that be a better place to set this also?

@@ -0,0 +1,83 @@
import { isEligibleForTeads } from './teads-eligibility';

describe('Teads Eligibility', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see some unit tests 🥳

Copy link
Member

@arelra arelra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work ✨

Just some minor suggestions

@emma-imber emma-imber marked this pull request as draft October 2, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants