Description
The @format context query describes information about the ad slot, the configuration and type of format in which the ad is being displayed and the format's current state (i.e. is it an expandable unit, if so what component is showing, etc).
Example Usage
One common usage of the @ad context is to hide and show parts of the ad depending on the kind of format the ad is being displayed as. An example of this would be hiding/showing the appropriate call-to-action button depending on if the ad is an expandable format or not.
.click-through-button {
display: inline-block;
}
.expand-button {
display: none;
}
@ad (expandable: true) {
.click-through-button {
display: none;
}
.expand-button {
display: inline-block;
}
}
| Feature Name | Javascript Name | Value | Example Value | Description |
|---|---|---|---|---|
ready | adReady | boolean | true | The ad has fully loaded and all content is ready. |
type | adType | in-content out-of-page | in-content | Describes the type of ad format. |
responsive | adResponsive | boolean | true | Boolean noting if the ad slot has responsify active. |
visible-iab | adVisibileIab | boolean | true | Boolean noting if the ad slot currently meets IAB requirements for being 'visible' |
visible | adVisible | boolean | true | Boolean noting if the ad slot is mostly showing. |
visibility | adVisibility | number | 90 | A number representing the percentage of the ad that is currently in view. |
visibility-x | adVisibilityX | number | 90 | A number representing the percentage of the ad that is currently in view along the x axis. |
visibility-y | adVisibilityY | number | 90 | A number representing the percentage of the ad that is currently in view along the y axis. |
banner-only | adBannerOnly | boolean | true | A boolean representing if the banner is the only component in the ad besides the loader. |
panel-only | adPanelOnly | boolean | true | A boolean representing if the panel is the only component in the ad besides the loader. |
current-state | adCurrentState | collapsed collapsing expanded expanding | collapsed | The name of the current state of the ad. |
experience | adExperience | rich static | rich | Describes the capabilities of the ad viewing experience. |
expandable | adExpandable | boolean | true | Boolean noting if the ad can expand into a larger size. |
expand-direction | adExpandDirection | n ne nw s sw se etc | ne | String noting the direction of the expand as a cardinal direction. |
expand-directions | adExpandDirections | Space separated list containing any of the following: n e s w | n | List of strings of all the directions that the expand will move in. |
slot-aspect-ratio | adSlotAspectRatio | number | 0.56 | The aspect ratio of the ad slot as calculated by width/height. |
publisher-channel | adPublisherChannel | string | espn | A string representing the publisher channel that the ad was trafficked against. |
first-interaction | adFirstInteracton | boolean | true | A boolean that notes if the ad has been interacted with yet. |
first-exit | adFirstExit | boolean | true | A boolean that notes if the user has triggered an exit yet. |
Updated less than a minute ago
