Skip to content

Commit

Permalink
AdsLoom AMP Integration (#22758)
Browse files Browse the repository at this point in the history
* AdsLoom AMP Integration

* Fixed LGTM issues
  • Loading branch information
safzal0906 authored and torch2424 committed Jun 19, 2019
1 parent 9b6c71f commit 8077654
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 1 deletion.
3 changes: 3 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import {adpon} from '../ads/adpon';
import {adreactor} from '../ads/adreactor';
import {adsense} from '../ads/google/adsense';
import {adsensor} from '../ads/adsensor';
import {adsloom} from '../ads/adsloom';
import {adsnative} from '../ads/adsnative';
import {adspeed} from '../ads/adspeed';
import {adspirit} from '../ads/adspirit';
Expand Down Expand Up @@ -269,6 +270,7 @@ import {zucks} from '../ads/zucks';
const AMP_EMBED_ALLOWED = {
_ping_: true,
'24smi': true,
adsloom: true,
bringhub: true,
dable: true,
engageya: true,
Expand Down Expand Up @@ -327,6 +329,7 @@ register('adpon', adpon);
register('adreactor', adreactor);
register('adsense', adsense);
register('adsensor', adsensor);
register('adsloom', adsloom);
register('adsnative', adsnative);
register('adspeed', adspeed);
register('adspirit', adspirit);
Expand Down
4 changes: 3 additions & 1 deletion ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export const adConfig = {
clientIdScope: 'amp_ecid_adensor',
renderStartImplemented: true,
},

'adsloom': {
clientIdScope: 'AMP_ECID_ADSLOOM',
},
'adsnative': {
prefetch: 'https://static.adsnative.com/static/js/render.v1.js',
preconnect: 'https://api.adsnative.com',
Expand Down
34 changes: 34 additions & 0 deletions ads/adsloom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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 {loadScript, validateData} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function adsloom(global, data) {
validateData(data, ['widgetId']);
global._adsLoom = global._adsLoom || {
widgetId: data['widgetId'],
clientId: global.context.clientId,
sourceUrl: global.context.sourceUrl,
};
loadScript(
global,
'https://adsloomwebservices.adsloom.com/scripts/amp-loader.js'
);
}
36 changes: 36 additions & 0 deletions ads/adsloom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!---
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.
-->

# AdsLoom

## Example of AdsLoom's widget implementation


```html
<amp-embed width="200" height="200"
type="adsloom"
layout="responsive"
data-widget-id="WIDGET_ID">
</amp-embed>
```

## Configuration

For details on the configuration, please contact AdsLoom.

### Required parameters

- `widget-id`: Widget ID
14 changes: 14 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
padding: 0;
height:100px;
}
amp-ad[type="adsloom"] {
width: 100%;
max-width: 980px;
margin: 18px auto;
padding: 0;
}
</style>
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
Expand Down Expand Up @@ -86,6 +92,7 @@
<option>adreactor</option>
<option>adsense</option>
<option>adsensor</option>
<option>adsloom</option>
<option>adsnative</option>
<option>adspeed</option>
<option>adspirit</option>
Expand Down Expand Up @@ -565,6 +572,13 @@ <h2>AdSensor</h2>
data-adunit-id="1226707">
</amp-ad>

<h2>AdsLoom</h2>
<amp-ad width="800" height="600"
type="adsloom"
layout="responsive"
data-widget-id="1079">
</amp-ad>

<h2>AdsNative</h2>
<amp-ad width="300" height="250"
type="adsnative"
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-ad/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [AdReactor](../../ads/adreactor.md)
- [AdSense](../../ads/google/adsense.md)
- [AdSensor](../../ads/adsensor.md)
- [AdsLoom](../../ads/adsloom.md)
- [AdsNative](../../ads/adsnative.md)
- [AdSpeed](../../ads/adspeed.md)
- [AdSpirit](../../ads/adspirit.md)
Expand Down Expand Up @@ -399,6 +400,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
## Supported embed types

- [24smi](../../ads/24smi.md)
- [AdsLoom](../../ads/adsloom.md)
- [Bringhub](../../ads/bringhub.md)
- [Dable](../../ads/dable.md)
- [Engageya](../../ads/engageya.md)
Expand Down

0 comments on commit 8077654

Please sign in to comment.