Ads
Theme Ad Timing
When each ad type starts loading based on theme configuration.
Ad start timing is controlled by components/utils/themeConfig.js via shouldStartAd() and shouldEnableAd().
| Constant | Meaning |
|---|
themeVisible | Start when theme overlay appears |
themeClosed | Start after theme overlay closes |
contentVisible | Start when content phase is visible |
always | Start immediately on page mount |
rewardedAdCtaClick | Start when user clicks rewarded CTA |
| Ad Type | Questionnaire | WhatsApp | Guide | Guide2 | Nothing |
|---|
| Display | themeVisible | themeVisible | themeVisible | themeClosed | always |
| Interstitial | themeVisible | CTA click | themeVisible | themeClosed | always |
| Skyscraper | themeClosed | themeClosed | themeVisible | themeClosed | always |
| Sticky | CTA click | themeClosed | themeVisible | themeClosed | always |
| Rewarded load | themeVisible | themeVisible | contentVisible | contentVisible | always |
| Rewarded trigger | CTA | CTA | CTA (popup) | CTA (popup) | CTA |
| Hook | File | Purpose |
|---|
useAdThemeTiming | components/hooks/useAdThemeTiming.js | Wraps shouldEnableAd + shouldStartAd |
useAdDelays | components/hooks/useAdDelays.js | Computes delay timers per ad type |
| Theme | Disabled ad types |
|---|
All except nothing | None (all 5 types enabled) |
nothing | Interstitial disabled |
// Simplified pattern in ad components
const { isAdEnabled, shouldRender } = useAdThemeTiming(
AD_TYPES.DISPLAY,
themeType,
{ themeClosed, contentVisible, rewardedAdTriggered }
);
if (!shouldRender) return null;
return <DisplayAd ... />;