Skip to content

DCAR: Toggle Display Of Ad Placeholders In Development #10170

@JamieB-gu

Description

@JamieB-gu

By default we don't show the ad placeholders that are used to insert ads; we only display them if we're able to check with the native layer that the user is not premium.

/**
* Setup Ads
*
* After first render, and only after first render, check if the user has
* the premium tier. If not, set up ads by looking for ad placeholder
* elements in the page and storing them. These will be used to render
* client-side ad slots.
*/
useEffect(() => {
void getUserClient()
.isPremium()
.then((isPremium) => {
if (!isPremium) {
setAdPlaceholders(
Array.from(
document.getElementsByClassName(adPlaceholderClass),
),
);
setRightAdPlaceholder(
document.getElementsByClassName(
rightAdsPlaceholderClass,
)[0],
);
}
});
}, []);

As a result, when viewing DCAR in a browser for development purposes you will never see the ad placeholders, because there is no native layer to query.

However, sometimes it's useful to be able to see these placeholders outside of the app. For example, when interactive developers (Design, Visuals) are building interactives they would like to be able to see them, to make sure they can work around them correctly.

We discussed coming up with a mechanism for toggling the placeholders on and off for development purposes, possibly with a query parameter. Ideally this parameter would work in preview.

Metadata

Metadata

Labels

Interactives 📈Pick me upsmall effort, self contained issues to do when you feel like a pick me up, waiting to be unblocked…Team Candidate: WebXmaintenanceDepartmental tracking: maintenance work, not a fix or a feature

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions