Skip to content

Commit

Permalink
📖amp story ads RTC & Targeting docs (ampproject#20818)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcordry authored Feb 13, 2019
1 parent b843500 commit bcce892
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions extensions/amp-story-auto-ads/amp-story-auto-ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ looks like the following:

`ad-attributes` is a map of key-value pairs, which are the attributes of the
`amp-ad` element to be inserted.
If you wish to pass any additional data (e.g. targeting information) as
attributes to the created `<amp-ad>` tag, simply add the additional key value
pairs to the `ad-attributes` JSON object.

The above example will insert the following `amp-ad` element, which represents
a [ad served by doubleclick](../../extensions/amp-ad-network-doubleclick-impl/amp-ad-network-doubleclick-impl-internal.md):
Expand All @@ -97,6 +94,48 @@ a [ad served by doubleclick](../../extensions/amp-ad-network-doubleclick-impl/am
Unlike normal `amp-ad`, no `<fallback>` or `<placeholder>` needs to be specified
here, as ads in stories will only be displayed once fully rendered.

### Passing additional attributes (RTC, Targeting, etc.)

If you wish to pass any additional data (e.g. targeting information) as
attributes to the created `<amp-ad>` tag, simply add the additional key value
pairs to the `ad-attributes` JSON object.

A common use case is to pass targeting data or RTC configuration to the underlying `amp-ad` element. A more complex configuration may look something like this:

```html
<amp-story-auto-ads>
<script type="application/json">
{
"ad-attributes": {
"type": "doubleclick",
"data-slot": "/30497360/a4a/amp_story_dfp_example",
"rtc-config": {
"urls": ["https://rtcEndpoint.biz/"]
},
json: {
"targeting": {
"loc": "usa",
"animal": "cat"
},
"categoryExclusions": ["sports", "food", "fun"]
}
}
}
</script>
</amp-story-auto-ads>
```

This would result in creation of the following `amp-ad` element.

```html
<amp-ad type="doubleclick"
data-slot="/30497360/a4a/amp_story_dfp_example"
rtc-config='{"urls": ["https://rtcEndpoint.biz/"}'
json='{"targeting":{"loc": "usa", "animal": "cat"}, "categoryExclusions":["sports", "food", "fun"]}'>
</amp-ad>
```


## Validation
`amp-story-auto-ads` must be a direct child of `amp-story` element.

Expand Down

0 comments on commit bcce892

Please sign in to comment.