questionnaire docs
Ads

AdSense Integration

Per-tenant AdSense provider switch and component behavior.

AdSense Integration

Tenants can use Google AdSense instead of GAM (AdX) for ad serving.

Entry: lib/utils/adProvider.js, components/ads/*

Provider switch

Set on tenant document:

adConfig: {
  adProvider: "adsense",  // or "adx" (default)
  adsensePublisherId: "ca-pub-XXXXX",
  adsenseChannelId: "optional-channel",
  adsenseDefaultDisplaySlotId: "slot-id",
  adsenseDefaultStickySlotId: "slot-id",
}

Architecture

Script loading

ProviderScriptLoaded in
AdXgpt.js with cmpNetworkCodeapp/layout.js
AdSenseadsbygoogle.js?client={publisherId}app/layout.js

PageLevelTargeting (GAM utm_source KV) runs only when adProvider === "adx".

Component mapping

PlacementAdSense componentConfig
DisplayAdSenseDisplaypublisherId + adSlot
InterstitialAdSenseInterstitialpublisherId only
RewardedAdSenseRewardedpublisherId only
StickyAdSenseStickypublisherId + adSlot
SkyscraperAdSenseSkyscrapperpublisherId + adSlot

Key differences from AdX

FeatureAdXAdSense
KV waterfallYesNo
Interstitial timingTheme-basedWait for onLoad
Rewarded triggerCTA / autoshowAd() on CTA
KV2 fallbackKV2 popupAuto showAd() on mount
Conversion pixelonAdReceivedonAdReceived via handleAdReceived(null)

Gotchas

  • Interstitial/rewarded must wait for AdBreak onLoad before showAd()
  • KV2 starts only when theme passes shouldStartKv2: true in onClose payload
  • Display/sticky wrappers use key + synchronous useScreenSize init to prevent TagError on resize
  • @unib0ts/ad-manager no-fill statuses remapped in lib/utils/adSenseAdBreak.js

On this page