Display a limited ad
This is an example of using the Google Publisher Tag (GPT) library to request and render a limited ad. Limited ads provide publishers a way to serve ads in the absence of consent for the use of cookies or other local identifiers. Learn more about the features and limitations of limited ads in the Google Ad Manager help center.
You can instruct GPT to request limited ads in two different ways:
- Automatically, by using a signal from an IAB TCF v2.0 consent management platform (CMP).
- Manually, by using the GPT
PrivacySettings
API.
In order to manually control limited ads, you must load GPT from the
limited ads URL. The version of GPT served from
this URL contains additional safeguards against accessing client-side storage by
default. To accomplish this, certain library operations are delayed until after
the first call to display()
, leading to a slight decrease in performance
compared to the standard version of GPT.
You can't manually control limited ads on a per-request basis when GPT is loaded
from the standard URL. When you load GPT from the standard URL, all calls to
setPrivacySettings({ limitedAds: ... })
are ignored and the library may
attempt to access client-side storage at any time. This allows GPT to more
effectively optimize the order of library operations. For example, GPT can
perform encrypted signal collection earlier,
increasing the likelihood that gathered signals will be included in every ad
request.