Shows how to load active cohorts for a visitor and pass them to Google Ad Manager (GAM) via the Google Publisher Tag (GPT) for ad targeting.
In this example, the call to the targetingKeyValues()
API happens first and, on success or error, banner
ads are loaded from Optable's demo GAM account via googletag.pubads().refresh()
. In order to
prevent ads loading until the asynchronous targeting
call is done, we start by disabling
automatic ads loading with googletag.pubads().disableInitialLoad()
.
To see an alternate way of loading GAM ads with targeting data where disableInitialLoad()
is
not required, check out the
cached targeting & GAM360 activation example
instead.