amphtml/amp-ad-network-doubleclick-impl-internal.md at main · ampproject/amphtml
Mục Lục
Google Ad Manager
Description
Google Ad Manager implementation of the AMP Ad tag. Click here
for Fast Fetch details, and here
for AMPHTML ad format details. This tag should
not be directly referenced by pages and instead is dynamically loaded
via the amp-ad tag. However, in order to remove an async script load
of this library, publishers can include its script declaration.
Availability
Launched
Required Script
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
Examples
See Example Section
Supported Features
Examples
Example – Google Ad Manager Ad
<
amp-ad
width
="728
"height
="90
"type
="doubleclick
"data-slot
="/6355419/Travel
">
</
amp-ad
>
Configuration
For semantics of configuration, please see ad network documentation.
Ad size
By default the ad size is based on the width
and height
attributes of the amp-ad
tag. In order to explicitly request different ad dimensions from those values, pass the attributes data-override-width
and data-override-height
to the ad.
Example:
<
amp-ad
width
="320
"height
="50
"data-override-width
="111
"data-override-height
="222
"type
="doubleclick
"data-slot
="/4119129/mobile_ad_banner
">
</
amp-ad
>
For multi-size attributes, see the multi-size documentation page.
Supported parameters
data-slot
: Full path of the ad unit with the network code and unit code.data-multi-size
: See the multi-size documentation page for details.data-multi-size-validation
Supported via json
attribute:
categoryExclusions
: Sets a slot-level category exclusion for the given label name.cookieOptions
: Sets options for ignoring DFP cookies on the current page.- 0: Enables DFP cookies on ad requests on the page. This option is set by default.
- 1: Ignores DFP cookies on subsequent ad requests and prevents cookies from being created on the page.
tagForChildDirectedTreatment
: Configures whether the slot should be treated as child-directed.
See the TFCD article for Small Business or Premium for more details and allowed values.targeting
: Sets a custom targeting parameter for this slot. Values must of the form:"<key_string>":"<value_string>"
or"<key_string>":["<value1>", "<value2>", ...]
. See below for example.
ppid
: Sets a custom provided user ID for targeting. Do not set when
serving responses to crawlers since this value is expected to be dynamic.
Example with json attribute:
<
amp-ad
width
="320
"height
="50
"type
="doubleclick
"data-slot
="/4119129/mobile_ad_banner
"json
='{"targeting":{"sport":["rugby","cricket"]},"categoryExclusions":["health"],"tagForChildDirectedTreatment":1}
'>
</
amp-ad
>
Supported DFP Formats
- Anchor Ads / Adhesion Units may be implemented using amp-sticky-ads.
- Expandable formats can now leverage the Safeframe API.
Unsupported DFP Formats
- Interstitials
- Flash
- Creatives served over HTTP.