New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨Add "conative" ad network support to amp-ad #25038
Changes from 3 commits
3cbec67
4c2dcf7
62c4d26
1e8160a
5f86d25
b9c9d03
5d8184d
cfbf2a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {validateData, writeScript} from '../3p/3p'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function conative(global, data) { | ||
validateData(data, ['domain', 'adslot', 'height']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are able to add optional params as a third arg to this function. Would you like to include |
||
|
||
data.domain = data.domain || null; | ||
data.adslot = data.adslot || null; | ||
data.preview = data.preview || null; | ||
|
||
window.dmConativeData = window.dmConativeData || {}; | ||
window.dmConativeData.domain = window.dmConativeData.domain || data.domain; | ||
window.dmConativeData.adslot = window.dmConativeData.adslot || data.adslot; | ||
window.dmConativeData.preview = window.dmConativeData.preview || data.preview; | ||
window.dmConativeData.visibility = window.dmConativeData.visibility || 0; | ||
|
||
window.context.observeIntersection(function(changes) { | ||
changes.forEach(function(c) { | ||
window.dmConativeData.visibility = parseInt( | ||
(c.intersectionRect.height / c.boundingClientRect.height) * 100, | ||
10 | ||
); | ||
}); | ||
}); | ||
|
||
if (data.domain) { | ||
writeScript( | ||
global, | ||
'//s3-eu-west-1.amazonaws.com/ccc-adscript/serve/domain/' + | ||
data.domain + | ||
'/config.js' | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!--- | ||
Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS-IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# CONATIVE | ||
|
||
CONATIVE support for AMP. | ||
|
||
## Example | ||
|
||
- All CONATIVE `<amp-ad>` tags require the `width`, `height`, `layout`, `sizes` and `type="conative"` parameters. | ||
|
||
```html | ||
<amp-ad | ||
height="250" | ||
width="300" | ||
type="conative" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can you indent all these to the same level? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, my bad! done! |
||
layout="responsive" | ||
sizes="(min-width: 320px) 320px, 100vw" | ||
data-domain="1" | ||
data-adslot="12"> | ||
</amp-ad> | ||
``` | ||
|
||
## Configuration | ||
|
||
For configuration details and to generate your tags, please contact https://www.definemedia.de/intelligent-content-marketing/#kontakt | ||
|
||
### Required parameters | ||
|
||
- `data-domain` | ||
- `data-adslot` | ||
|
||
### Optional parameters | ||
|
||
- `data-preview` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verified
renderStart
is being called. 👍