Skip to content

Commit

Permalink
✨ PromoteIQ : add (#20694)
Browse files Browse the repository at this point in the history
* PromoteIQ - add

* PromoteIQ - add

* promoteiq - added global reference to TagDeliveryContent object

* promoteiq - added newline to end of file and removed trailing spaces

* removed spaces after curly brackets

* added promoteiq properties to ads.extern.js for compiling purposes

* replaces JSON.parse with parseJson wrapper function

* updated variable referencing

* updated promoteiq example and sfcallback function

* removed promoteiq from file

* updated dot notation to bracket notation
  • Loading branch information
aisleypay authored and torch2424 committed Feb 20, 2019
1 parent 6f6d263 commit 77b81a9
Show file tree
Hide file tree
Showing 6 changed files with 94 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 @@ -199,6 +199,7 @@ import {polymorphicads} from '../ads/polymorphicads';
import {popin} from '../ads/popin';
import {postquare} from '../ads/postquare';
import {pressboard} from '../ads/pressboard';
import {promoteiq} from '../ads/promoteiq';
import {pubexchange} from '../ads/pubexchange';
import {pubguru} from '../ads/pubguru';
import {pubmatic} from '../ads/pubmatic';
Expand Down Expand Up @@ -438,6 +439,7 @@ register('polymorphicads', polymorphicads);
register('popin', popin);
register('postquare', postquare);
register('pressboard', pressboard);
register('promoteiq', promoteiq);
register('pubexchange', pubexchange);
register('pubguru', pubguru);
register('pubmatic', pubmatic);
Expand Down
2 changes: 2 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ export const adConfig = {
renderStartImplemented: true,
},

'promoteiq': {},

'pubexchange': {},

'pubguru': {
Expand Down
40 changes: 40 additions & 0 deletions ads/promoteiq.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* 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';
import {parseJson} from '../src/json';
import {user} from '../src/log';

const TAG = 'PROMOTEIQ';
const mandatoryDataFields = ['src', 'params', 'sfcallback'];

/**
* @param {!Window} global
* @param {!Object} data
*/
export function promoteiq(global, data) {
validateData(data, mandatoryDataFields, []);
const sfInputs = parseJson(data['params']);

loadScript(global, data['src'], () => {
if (!!global['TagDeliveryContent']) {
const sfCallback = new Function('response', data['sfcallback']);
global['TagDeliveryContent']['request'](sfInputs, sfCallback);
} else {
user().error(TAG, 'TagDeliveryContent object not loaded on page');
}
});
}
40 changes: 40 additions & 0 deletions ads/promoteiq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!---
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.
-->

# PromoteIQ

Provides support for AMP integration with [PromoteIQ](https://www.promoteiq.com/).

## Example

```html
<amp-ad width="250" height="250"
type="promoteiq"
data-src="https://example.com/cdn/file.js"
data-params='{"param1": "XXX", "param2": "YYY", ....}'
data-sfcallback='function (response){ return response;}'>
</amp-ad>
```

### Required parameters

- `data-src`: Publisher specific PromoteIQ CDN file.
- `data-input`: JSON stringified inputs.
- `data-sfcallback`: Stringified publisher rendering function.

# Support

For further queries, please feel free to reach out to your contact at PromoteIQ.
9 changes: 9 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
<option>polymorphicads</option>
<option>popin</option>
<option>pressboard</option>
<option>promoteiq</option>
<option>pubexchange</option>
<option>pubmine</option>
<option>pulsepoint</option>
Expand Down Expand Up @@ -1469,6 +1470,14 @@ <h2>Pressboard</h2>
data-media="5">
</amp-ad>

<h2>PromoteIQ</h2>
<amp-ad width="250" height="250"
type="promoteiq"
data-src="http://cdn.tagdelivery.com/request/client/standard.js"
data-params='{"slot": 1160, "targets": { "category": ["6222", "16158", "274", "17912"]}, "count": 1}'
data-sfcallback="if (!Array.isArray(response)) { response = [response]; }; for (i = 0; i < response.length; i++) { const prod = response[i]; let outerCtr = document.createElement('div'); let img = document.createElement('img'); img.src = prod['product']['imageLarge']; img.style = 'height:250px; width:250px'; outerCtr.appendChild(img); document.body.appendChild(outerCtr); }">
</amp-ad>

<h2>PubExchange</h2>
<amp-embed width="640" height="320"
heights="(max-width:480px) 400%, (max-width:650px) 100%, 75%"
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 @@ -327,6 +327,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [polymorphicAds](../../ads/polymorphicads.md)
- [popin](../../ads/popin.md)
- [Pressboard](../../ads/pressboard.md)
- [PromoteIQ](../../ads/promoteiq.md)
- [PubGuru](../../ads/pubguru.md)
- [PubMatic](../../ads/pubmatic.md)
- [Pubmine](../../ads/pubmine.md)
Expand Down

0 comments on commit 77b81a9

Please sign in to comment.