Skip to content

Commit

Permalink
Merge pull request #2299 from criteo-forks/master
Browse files Browse the repository at this point in the history
Add Criteo support to amp-ad
  • Loading branch information
cramforce committed Mar 2, 2016
2 parents 2aade12 + 2d3fbb5 commit d528074
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 3p/integration.js
Expand Up @@ -30,6 +30,7 @@ import {adreactor} from '../ads/adreactor';
import {adsense} from '../ads/adsense';
import {adtech} from '../ads/adtech';
import {plista} from '../ads/plista';
import {criteo} from '../ads/criteo';
import {doubleclick} from '../ads/doubleclick';
import {dotandads} from '../ads/dotandads';
import {endsWith} from '../src/string';
Expand Down Expand Up @@ -64,6 +65,7 @@ register('adreactor', adreactor);
register('adsense', adsense);
register('adtech', adtech);
register('plista', plista);
register('criteo', criteo);
register('doubleclick', doubleclick);
register('flite', flite);
register('taboola', taboola);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Expand Up @@ -28,6 +28,7 @@ export const adPrefetch = {
],
a9: 'https://c.amazon-adsystem.com/aax2/assoc.js',
adsense: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js',
criteo: 'https://static.criteo.net/js/ld/publishertag.js',
dotandads: 'https://amp.ad.dotandad.com/dotandadsAmp.js',
mediaimpact: 'https://ec-ns.sascdn.com/diff/251/divscripte/amp.js',
smartadserver: 'https://ec-ns.sascdn.com/diff/js/smart.js',
Expand Down Expand Up @@ -58,6 +59,9 @@ export const adPreconnect = {
'https://a.teads.tv',
'https://t.teads.tv',
],
criteo: [
'https://cas.criteo.com',
],
doubleclick: [
'https://partner.googleadservices.com',
'https://securepubads.g.doubleclick.net',
Expand Down
27 changes: 27 additions & 0 deletions ads/criteo.js
@@ -0,0 +1,27 @@
/**
* 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} from '../src/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function criteo(global, data) {
loadScript(global, 'https://static.criteo.net/js/ld/publishertag.js', () => {
Criteo.DisplayAd({'zoneid': data.zone});
});
}
39 changes: 39 additions & 0 deletions ads/criteo.md
@@ -0,0 +1,39 @@
<!---
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.
-->

# Criteo

## Example

```html
<amp-ad width=300 height=250
type="criteo"
data-zone="314159">
</amp-ad>
```

## Ad size

The ad size is based on the setup of your Criteo zone. The `width` and `height` attributes of the `amp-ad` tag should match that.


## Configuration

For configuration details and to generate your tags, please refer to [your publisher account](https://publishers.criteo.com) or contact publishers@criteo.com.

Supported parameters:

- `data-zone`: your Criteo zone identifier.
1 change: 1 addition & 0 deletions builtins/amp-ad.md
Expand Up @@ -97,6 +97,7 @@ resources in AMP. It requires a `type` argument that select what ad network is d
- [AdReactor](../ads/adreactor.md)
- [AdSense](../ads/adsense.md)
- [AdTech](../ads/adtech.md)
- [Criteo](../ads/criteo.md)
- [Dot and Media](../ads/dotandads.md)
- [Doubleclick](../ads/doubleclick.md)
- [Flite](../ads/flite.md)
Expand Down
1 change: 1 addition & 0 deletions docs/include_features.md
Expand Up @@ -278,6 +278,7 @@ The following ad networks are supported in AMP HTML pages:
- [AdReactor](../ads/adreactor.md)
- [AdSense](../ads/adsense.md)
- [AdTech](../ads/adtech.md)
- [Criteo](../ads/criteo.md)
- [Doubleclick](../ads/doubleclick.md)

## Display an ad
Expand Down
6 changes: 6 additions & 0 deletions examples/ads.amp.html
Expand Up @@ -138,6 +138,12 @@ <h2>Challenging ad.</h2>
data-slot="/35096353/amptesting/badvideoad">
</amp-ad>

<h2>Criteo</h2>
<amp-ad width="300" height="250"
type="criteo"
data-zone="314159">
</amp-ad>

<h2>Flite</h2>
<amp-ad width=320 height=568
type = "flite"
Expand Down
1 change: 1 addition & 0 deletions test/functional/test-integration.js
Expand Up @@ -39,6 +39,7 @@ describe('3p integration.js', () => {
expect(registrations).to.include.key('adsense');
expect(registrations).to.include.key('adtech');
expect(registrations).to.include.key('adreactor');
expect(registrations).to.include.key('criteo');
expect(registrations).to.include.key('doubleclick');
expect(registrations).to.include.key('flite');
expect(registrations).to.include.key('twitter');
Expand Down

0 comments on commit d528074

Please sign in to comment.