label, the text string to be used as the new label for the tooltip.
content, the HTML string to be inserted into the tooltip.
const label =`Advertiser Perspective`;
const content =`This content was created in collaboration with T Brand, the content studio of New York Times Advertising. The news and editorial staff of The New York Times had no role in this post's creation.`;
customTooltip(label, content);
If you are in a SSR context, call the function only when the DOM is ready. For example, in Svelte:
import{ onMount }from'svelte';
onMount(()=>{
customTooltip(label, content);
});
3) Add custom styles
As paid post functions are called only after the NYT furniture render, you might see a flash showing the default top bar label. To mitigate this, we might want to add this global style to the page:
.paid-post-tooltip:not(.is-custom){
visibility: hidden;
}
On smaller screen the label might have to go on two lines. As the question mark icon position is relative to the label container, we might want to add this global style to the page to narrow the width of the label on smaller devices:
@media(max-width: 640px){
.paid-post-tooltip button p{
width: min-content;
}
}
Tips
To debug, paste this in console before opening the tooltip.