Most slot-level properties in the UI can also be set programmatically by specifying inline DIV attributes. When set, the DIV-level attributes take precedence, overriding the behavior specified in the UI.
data-unit
Set the GAM Ad Unit.
Example
<div class="htlad-leaderboard"
data-unit="/1234/leaderboard/sports">
</div>
data-targeting
Set slot-level targeting. The targeting MUST be JSON-encoded
Example
<div class="htlad-leaderboard"
data-targeting='{"pos":"top"}'>
</div>
data-eager
Enable eager loading (overrides “lazy-loading, if configured in the UI)
Example
<div class="htlad-leaderboard"
data-eager>
</div>
data-lazy-pixels
Specify the lazy-loading pixel offset. When a user scrolls down the page, this is the number of pixels away from the viewport when the ad will be fetched.
Example
- Begin fetching the ad when it is 900px away from entering the screen
Code
<div class="htlad-leaderboard"
data-lazy-pixels="900">
</div>
data-gpid
Set the GPID value.
Example
<div class="htlad-leaderboard"
data-gpid="/1234/leaderboard/sports">
</div>
data-sizes
Set the eligible creative sizes. Accepts a pipe-separated list of sizes available at each viewport width
Example:
- Sets 300x250 for mobile / small viewport
- Sets 728x90 for tablet / medium viewport
- Sets 728x90 and 970x250 for desktop / large viewport
Code
<div class="htlad-leaderboard"
data-sizes="0x0:300x250|768x0:728x90|1024x0:728x90,970x250">
</div>