Skip to content
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

Merged
merged 8 commits into from Oct 16, 2019
Merged
2 changes: 2 additions & 0 deletions 3p/integration.js
Expand Up @@ -118,6 +118,7 @@ import {caprofitx} from '../ads/caprofitx';
import {cedato} from '../ads/cedato';
import {chargeads, nws} from '../ads/nws';
import {colombia} from '../ads/colombia';
import {conative} from '../ads/conative';
import {connatix} from '../ads/connatix';
import {contentad} from '../ads/contentad';
import {criteo} from '../ads/criteo';
Expand Down Expand Up @@ -381,6 +382,7 @@ register('caprofitx', caprofitx);
register('cedato', cedato);
register('chargeads', chargeads);
register('colombia', colombia);
register('conative', conative);
register('connatix', connatix);
register('contentad', contentad);
register('criteo', criteo);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Expand Up @@ -351,6 +351,10 @@ const adConfig = jsonConfiguration({
prefetch: 'https://static.clmbtech.com/ad/commons/js/colombia-amp.js',
},

'conative': {
renderStartImplemented: true,
Copy link
Member

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. 👍

},

'connatix': {
renderStartImplemented: true,
},
Expand Down
53 changes: 53 additions & 0 deletions ads/conative.js
@@ -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']);
Copy link
Member

Choose a reason for hiding this comment

The 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 preview here?


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'
);
}
}
48 changes: 48 additions & 0 deletions ads/conative.md
@@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you indent all these to the same level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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`
14 changes: 14 additions & 0 deletions examples/ads.amp.html
Expand Up @@ -125,6 +125,7 @@
<option>capirs</option>
<option>caprofitx</option>
<option>cedato</option>
<option>conative</option>
<option>connatix</option>
<option>contentad</option>
<option>criteo</option>
Expand Down Expand Up @@ -861,6 +862,19 @@ <h2>Cedato</h2>
data-id="303084288">
</amp-ad>

<h2>Conative</h2>

<amp-ad
type="conative"
height="250"
width="300"
layout="responsive"
sizes="(min-width: 320px) 320px, 100vw"
data-domain="225"
data-adslot="1977"
data-preview="1">
</amp-ad>

<h2>Connatix</h2>
<amp-ad width="300" height="250"
type="connatix"
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-ad/amp-ad.md
Expand Up @@ -284,6 +284,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [Cedato](../../ads/cedato.md)
- [Colombia](../../ads/colombia.md)
- [Connatix](../../ads/connatix.md)
- [Conative](../../ads/conative.md)
- [Content.ad](../../ads/contentad.md)
- [Criteo](../../ads/criteo.md)
- [CSA](../../ads/google/csa.md)
Expand Down