fix(ads): render iframe OR fallback image, not both
This commit is contained in:
@@ -23,17 +23,7 @@ const ADSANITY_CAMPAIGN_MAP: Record<string, string> = {
|
|||||||
'lectrosonics': 'ad-156727',
|
'lectrosonics': 'ad-156727',
|
||||||
'livu-300': 'ad-156486',
|
'livu-300': 'ad-156486',
|
||||||
'magewell': 'ad-154296',
|
'magewell': 'ad-154296',
|
||||||
'blackmagic': 'ad-210571',
|
'blackmagic': 'ad-210571'
|
||||||
'magewell-300': 'ad-154296',
|
|
||||||
'studio-suite-300': 'ad-162714',
|
|
||||||
'zixi-300': 'ad-156737',
|
|
||||||
'lectrosonics-300': 'ad-156727',
|
|
||||||
'aja-300': 'ad-164285',
|
|
||||||
'livu-300-2': 'ad-156486',
|
|
||||||
'opengear-300': 'ad-200174',
|
|
||||||
'look-solutions-300': 'ad-208185',
|
|
||||||
'riedel-300': 'ad-210571',
|
|
||||||
'telycam-300': 'ad-191740'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function AdImage({ ad, page, priority }: { ad: Ad; page?: string; priority?: boolean }) {
|
export default function AdImage({ ad, page, priority }: { ad: Ad; page?: string; priority?: boolean }) {
|
||||||
@@ -73,15 +63,23 @@ export default function AdImage({ ad, page, priority }: { ad: Ad; page?: string;
|
|||||||
}).catch(err => console.error('Click:', err));
|
}).catch(err => console.error('Click:', err));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const width = parseInt(ad.size.split('x')[0]);
|
||||||
|
const height = parseInt(ad.size.split('x')[1]);
|
||||||
|
|
||||||
|
if (adsanityId) {
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} className="ad-container">
|
||||||
|
<iframe src={`https://ads.broadcastbeat.com/wp-content/plugins/adsanity/render.php?id=${adsanityId}`} width={width} height={height} frameBorder="0" scrolling="no" style={{display:'block'}} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={containerRef} className="ad-container">
|
<div ref={containerRef} className="ad-container">
|
||||||
{adsanityId && (
|
|
||||||
<iframe src={`https://ads.broadcastbeat.com/wp-content/plugins/adsanity/render.php?id=${adsanityId}`} width={parseInt(ad.size.split('x')[0])} height={parseInt(ad.size.split('x')[1])} frameBorder="0" scrolling="no" style={{display:'block'}} onError={() => console.warn('AdSanity iframe failed, bb.banner_analytics tracking active')} />
|
|
||||||
)}
|
|
||||||
{ad.click_url ? (
|
{ad.click_url ? (
|
||||||
<a href={ad.click_url} rel="sponsored noopener noreferrer" onClick={handleClick} style={{display:'none'}}><AppImage src={ad.src} alt={ad.label} width={parseInt(ad.size.split('x')[0])} height={parseInt(ad.size.split('x')[1])} priority={priority} /></a>
|
<a href={ad.click_url} rel="sponsored noopener noreferrer" onClick={handleClick}><AppImage src={ad.src} alt={ad.label} width={width} height={height} priority={priority} /></a>
|
||||||
) : (
|
) : (
|
||||||
<AppImage src={ad.src} alt={ad.label} width={parseInt(ad.size.split('x')[0])} height={parseInt(ad.size.split('x')[1])} priority={priority} style={{display:'none'}} />
|
<AppImage src={ad.src} alt={ad.label} width={width} height={height} priority={priority} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user