Skip to content

Commit

Permalink
Add amp-ad support for AppVador (ampproject#12163)
Browse files Browse the repository at this point in the history
* Add amp-ad support for AppVador

* fix issues

* add renderStartImplemented

- add renderStartImplemented
- fix bug

* fix issues

fix indent.
change creative.
  • Loading branch information
adg-dev authored and protonate committed Mar 15, 2018
1 parent 90f4dec commit dfe528f
Show file tree
Hide file tree
Showing 6 changed files with 106 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 @@ -106,6 +106,7 @@ import {advertserve} from '../ads/advertserve';
import {affiliateb} from '../ads/affiliateb';
import {amoad} from '../ads/amoad';
import {appnexus} from '../ads/appnexus';
import {appvador} from '../ads/appvador';
import {atomx} from '../ads/atomx';
import {bidtellect} from '../ads/bidtellect';
import {brainy} from '../ads/brainy';
Expand Down Expand Up @@ -286,6 +287,7 @@ register('advertserve', advertserve);
register('affiliateb', affiliateb);
register('amoad', amoad);
register('appnexus', appnexus);
register('appvador', appvador);
register('atomx', atomx);
register('bidtellect', bidtellect);
register('brainy', brainy);
Expand Down
11 changes: 11 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ export const adConfig = {
renderStartImplemented: true,
},

appvador: {
prefetch: [
'https://cdn.apvdr.com/js/VastAdUnit.min.js',
'https://cdn.apvdr.com/js/VideoAd.min.js',
'https://cdn.apvdr.com/js/VideoAd3PAS.min.js',
'https://cdn.apvdr.com/js/VideoAdAutoPlay.min.js',
'https://cdn.apvdr.com/js/VideoAdNative.min.js',
],
renderStartImplemented: true,
},

amoad: {
prefetch: [
'https://j.amoad.com/js/a.js',
Expand Down
47 changes: 47 additions & 0 deletions ads/appvador.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright 2017 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 {writeScript, validateData} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function appvador(global, data) {
validateData(data, ['id'], ['options', 'jsType', 'customScriptSrc']);

const container = global.document.getElementById('c');
const apvDiv = global.document.createElement('div');
apvDiv.setAttribute('id', 'apvad-' + data.id);
container.appendChild(apvDiv);

const scriptUrl = data.customScriptSrc ? data.customScriptSrc :
'https://cdn.apvdr.com/js/' +
(data.jsType ? encodeURIComponent(data.jsType) : 'VastAdUnit') +
'.min.js';
const apvScript = 'new APV.' +
(data.jsType ? data.jsType : 'VASTAdUnit') +
'({s:"' + data.id + '",isAmpAd:true' +
(data.options ? (',' + data.options) : '') + '}).load();';

const cb = function() {
const apvLoadScript = global.document.createElement('script');
apvLoadScript.text = apvScript;
container.appendChild(apvLoadScript);
};

writeScript(global, scriptUrl, cb);
}
38 changes: 38 additions & 0 deletions ads/appvador.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!---
Copyright 2017 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.
-->

# AppVador

## Example

```html
<amp-ad width="320" height="180"
type="appvador"
data-id="7393d415ebe7366b0cc24478c5675ee0">
</amp-ad>
```

## Configuration

For semantics of configuration, please contact [AppVador](http://www.appvador.com/).

### Required Parameters:
- data-id

### Optional parameters:
- data-options
- data-js-type
- data-custom-script-src
7 changes: 7 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<option>affiliateb</option>
<option>amoad</option>
<option>appnexus</option>
<option>appvador</option>
<option>atomx</option>
<option>bidtellect</option>
<option>brainy</option>
Expand Down Expand Up @@ -485,6 +486,12 @@ <h2>AppNexus with JSON based configuration multi ad</h2>
json='{"pageOpts":{"member": 958}, "adUnits": [{"disablePsa": true, "tagId": 6063968,"sizes": [300,250],"targetId": "apn_ad_1"}, {"tagId": 6063968,"sizes": [728,90],"targetId":"apn_ad_2"}]}'>
</amp-ad>

<h2>AppVador</h2>
<amp-ad width="320" height="180"
type="appvador"
data-id="8c328a2daa6f9ce4693f57246cd86e0a">
</amp-ad>

<h2>Atomx</h2>
<amp-ad width="300" height="250"
type="atomx"
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-ad/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [Affiliate-B](../../ads/affiliateb.md)
- [AMoAd](../../ads/amoad.md)
- [AppNexus](../../ads/appnexus.md)
- [AppVador](../../ads/appvador.md)
- [Atomx](../../ads/atomx.md)
- [Bidtellect](../../ads/bidtellect.md)
- [brainy](../../ads/brainy.md)
Expand Down

0 comments on commit dfe528f

Please sign in to comment.