Skip to content

Commit

Permalink
Implement Teads on Google AMP Ads network
Browse files Browse the repository at this point in the history
  • Loading branch information
RonanDrouglazet committed Feb 29, 2016
1 parent b765434 commit 654ade6
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {taboola} from '../ads/taboola';
import {smartadserver} from '../ads/smartadserver';
import {revcontent} from '../ads/revcontent';
import {openadstream} from '../ads/openadstream';
import {teads} from '../ads/teads';

/**
* Whether the embed type may be used with amp-embed tag.
Expand Down Expand Up @@ -76,6 +77,7 @@ register('smartadserver', smartadserver);
register('mediaimpact', mediaimpact);
register('revcontent', revcontent);
register('openadstream', openadstream);
register('teads', teads);

// For backward compat, we always allow these types without the iframe
// opting in.
Expand Down
7 changes: 7 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const adPrefetch = {
smartadserver: 'https://ec-ns.sascdn.com/diff/js/smart.js',
yieldmo: 'https://static.yieldmo.com/ym.amp1.js',
revcontent: 'https://labs-cdn.revcontent.com/build/amphtml/revcontent.amp.min.js',
teads: 'https://cdn.teads.tv/media/format/v3/teads-format.min.js',
};

/**
Expand All @@ -51,6 +52,12 @@ export const adPreconnect = {
'https://trc.taboola.com',
'https://images.taboola.com',
],
teads: [
'https://cdn.teads.tv',
'https://cdn2.teads.tv',
'https://a.teads.tv',
'https://t.teads.tv',
],
doubleclick: [
'https://partner.googleadservices.com',
'https://securepubads.g.doubleclick.net',
Expand Down
34 changes: 34 additions & 0 deletions ads/teads.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright 2015 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 {loadScript, checkData, validateDataExists} from '../src/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function teads(global, data) {
/*eslint "google-camelcase/google-camelcase": 0*/
global._teads_amp = {
allowed_data: ['pid'],
data: data,
};

validateDataExists(data, global._teads_amp.allowed_data);
checkData(data, global._teads_amp.allowed_data);

loadScript(global, 'https://a.teads.tv/page/' + encodeURIComponent(data.pid) + '/tag');
}
38 changes: 38 additions & 0 deletions ads/teads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!---
Copyright 2015 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.
-->

# Teads

## Example

```html
<amp-ad width=300 height=220
type="teads"
data-pid="42266"
layout="responsive">
<div fallback>Teads fallback - Discover <a href="http://teads.tv/en/platform/">inRead by Teads</a>!</div>
</amp-ad>
```

## Configuration

For semantics of configuration, please contact [Teads](http://teads.tv/fr/contact/).

Teads amp-ad component is designed to work with layout="responsive", so please be careful to keep width and height at a 4/3 ratio.

Supported parameters:

- data-pid
1 change: 1 addition & 0 deletions builtins/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ resources in AMP. It requires a `type` argument that select what ad network is d
- [Smart AdServer](../ads/smartadserver.md)
- [Yieldmo](../ads/yieldmo.md)
- [Revcontent](../ads/revcontent.md)
- [Teads](../ads/teads.md)

## Styling

Expand Down
9 changes: 9 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ <h2>AdTech</h2>
src="https://adserver.adtechus.com/addyn/3.0/5280.1/2274008/0/-1/ADTECH;size=300x250;key=plumber;alias=careerbear-ros-middle1;loc=300;;target=_blank;grp=27980912;misc=3767074">
</amp-ad>

<h2>Teads</h2>
<amp-ad width=300 height=220
type="teads"
data-pid="42266"
layout="responsive">

<div fallback>Teads fallback - Discover <a href="http://teads.tv/en/platform/">inRead by Teads</a> !</div>
</amp-ad>

<h2>Doubleclick</h2>
<amp-ad width=320 height=50
type="doubleclick"
Expand Down

0 comments on commit 654ade6

Please sign in to comment.