Skip to content

Commit

Permalink
Don't add advertisement labels to Hosted By ads served by opt out (#1464
Browse files Browse the repository at this point in the history
)

* Don't add an ad label to hosted by native ads on opt-out

* Changeset
  • Loading branch information
emma-imber authored Jul 15, 2024
1 parent 479b32f commit aa3cbc1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-schools-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/commercial': patch
---

Add labels for Hosted By template ads on opt out
4 changes: 4 additions & 0 deletions src/init/consentless/define-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const defineSlot = (
slot.classList.add('ad-slot--native');
}

if (optOutExt.tags.includes('HOSTEDBY')) {
slot.classList.add('ad-slot--hostedby');
}

void renderConsentlessAdvertLabel(slot);
};

Expand Down
1 change: 1 addition & 0 deletions src/init/consentless/render-advert-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const shouldRenderConsentlessLabel = (adSlotNode: HTMLElement): boolean => {
adSlotNode.classList.contains('ad-slot--frame') ||
adSlotNode.classList.contains('ad-slot--gc') ||
adSlotNode.classList.contains('u-h') ||
adSlotNode.classList.contains('ad-slot--hostedby') ||
// set for out-of-page (1x1) and empty (2x2) ads
adSlotNode.classList.contains('ad-slot--collapse') ||
adSlotNode.getAttribute('data-label') === 'false'
Expand Down

0 comments on commit aa3cbc1

Please sign in to comment.