Skip to content

Commit

Permalink
amd-ad: add type=sas network implementation (#20534)
Browse files Browse the repository at this point in the history
* amd-ad: add type=sas network implementation

* make sas.js use parseJson and renderStart

* update copyright

* add layout attribute

* alphabetize imports
  • Loading branch information
sthilt-sas authored and torch2424 committed Feb 20, 2019
1 parent 61741ce commit 3f3e6dd
Show file tree
Hide file tree
Showing 6 changed files with 125 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 @@ -215,6 +215,7 @@ import {revjet} from '../ads/revjet';
import {rfp} from '../ads/rfp';
import {rubicon} from '../ads/rubicon';
import {runative} from '../ads/runative';
import {sas} from '../ads/sas';
import {sekindo} from '../ads/sekindo';
import {sharethrough} from '../ads/sharethrough';
import {sklik} from '../ads/sklik';
Expand Down Expand Up @@ -454,6 +455,7 @@ register('revjet', revjet);
register('rfp', rfp);
register('rubicon', rubicon);
register('runative', runative);
register('sas', sas);
register('sekindo', sekindo);
register('sharethrough', sharethrough);
register('sklik', sklik);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,10 @@ export const adConfig = {
renderStartImplemented: true,
},

'sas': {
renderStartImplemented: true,
},

'sekindo': {
renderStartImplemented: true,
},
Expand Down
56 changes: 56 additions & 0 deletions ads/sas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* 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 {parseJson} from '../src/json';
import {validateData, writeScript} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function sas(global, data) {
let url, adHost;
const fields = ['site', 'size', 'area'];
validateData(data, ['customerName'],
['adHost', 'site', 'size', 'area', 'mid','tags']);

if (typeof data.adHost === 'undefined') {
adHost = encodeURIComponent(data['customerName']) + '-ads.aimatch.com';
}
else {
adHost = encodeURIComponent(data['adHost']);
}

url = '//' + adHost + '/' + data['customerName'] + '/jserver';

for (let idx = 0; idx < fields.length; idx++) {
if (data[fields[idx]]) {
if (typeof data[fields[idx]] !== 'undefined') {
url += '/' + fields[idx] + '=' + encodeURIComponent(data[fields[idx]]);
}
}
}

if (typeof data.tags !== 'undefined') {
const tags = parseJson(data.tags);
for (const tag in tags) {
url += '/' + tag + '=' + encodeURIComponent(tags[tag]);
}
}
writeScript(global, url, () => {
global.context.renderStart();
});
}
48 changes: 48 additions & 0 deletions ads/sas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!---
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.
-->

# SAS CI 360 Match

## Example

```html
<amp-ad
width="468"
height="60"
type="sas"
layout="fixed"
data-customer-name="canary"
data-size="320x50"
data-area="areaname"
data-site="sitename"
data-tags='{"CAT":"SYLVESTER","POSITION":"TOP"}'
>
</amp-ad>
```

## Configuration
For configuration details, please email support@sas.com.

### Required parameters

- `data-customer-name`

### Optional parameters

- `data-size`
- `data-site`
- `data-area`
- `data-tags`
14 changes: 14 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
<option>rfp</option>
<option>rubicon</option>
<option>runative</option>
<option>sas</option>
<option>sekindo</option>
<option>sharethrough</option>
<option>sklik</option>
Expand Down Expand Up @@ -1624,6 +1625,19 @@ <h2>RUNative</h2>
data-title="From the Web">
</amp-embed>

<h2>SAS CI 360 Match</h2>
<amp-ad
width="468"
height="60"
type="sas"
layout="fixed"
data-customer-name="canary"
data-size="468x60"
data-area="amp_ad_area"
data-site="amp_ad_site"
data-tags='{"CAT":"SYLVESTER","POSITION":"TOP"}'>
</amp-ad>

<h2>Sekindo</h2>
<amp-ad width="300" height="250"
type="sekindo"
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 @@ -342,6 +342,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [RevJet](../../ads/revjet.md)
- [Rubicon Project](../../ads/rubicon.md)
- [RUNative](../../ads/runative.md)
- [SAS CI 360 Match](../../ads/sas.md)
- [Sekindo](../../ads/sekindo.md)
- [Sharethrough](../../ads/sharethrough.md)
- [Sklik](../../ads/sklik.md)
Expand Down

0 comments on commit 3f3e6dd

Please sign in to comment.