Skip to content

Commit

Permalink
Add amp-ad support for Atomx (#4566)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdubbelboer authored and lannka committed Aug 29, 2016
1 parent a1d2545 commit 11b1af6
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 3p/integration.js
Expand Up @@ -52,6 +52,7 @@ import {adtech} from '../ads/adtech';
import {aduptech} from '../ads/aduptech';
import {amoad} from '../ads/amoad';
import {appnexus} from '../ads/appnexus';
import {atomx} from '../ads/atomx';
import {caprofitx} from '../ads/caprofitx';
import {chargeads} from '../ads/chargeads';
import {colombia} from '../ads/colombia';
Expand Down Expand Up @@ -131,6 +132,7 @@ register('adtech', adtech);
register('aduptech', aduptech);
register('amoad', amoad);
register('appnexus', appnexus);
register('atomx', atomx);
register('caprofitx', caprofitx);
register('chargeads', chargeads);
register('colombia', colombia);
Expand Down
1 change: 1 addition & 0 deletions ads/_config.js
Expand Up @@ -38,6 +38,7 @@ export const adPrefetch = {
'https://j.amoad.com/js/n.js',
],
appnexus: 'https://acdn.adnxs.com/ast/ast.js',
atomx: 'https://s.ato.mx/p.js',
caprofitx: [
'https://cdn.caprofitx.com/pfx.min.js',
'https://cdn.caprofitx.com/tags/amp/profitx_amp.js',
Expand Down
42 changes: 42 additions & 0 deletions ads/atomx.js
@@ -0,0 +1,42 @@
/**
* Copyright 2016 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 atomx(global, data) {
const optionals = ['click', 'uv1', 'uv2', 'uv3', 'context'];

validateData(data, ['id'], optionals);

const args = [
'size=' + data.width + 'x' + data.height,
'id=' + encodeURIComponent(data.id),
];

for (let i = 0; i < optionals.length; i++) {
const optional = optionals[i];
if (optional in data) {
args.push(optional + '=' + encodeURIComponent(data[optional]));
}
}

writeScript(global, 'https://s.ato.mx/p.js#' + args.join('&'));
}

39 changes: 39 additions & 0 deletions ads/atomx.md
@@ -0,0 +1,39 @@
<!---
Copyright 2016 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.
-->

# Atomx

## Example

```html
<amp-ad width=300 height=250
type="atomx"
data-id="1234">
</amp-ad>
```

## Configuration

For configuration, please see [atomx documentation](https://wiki.atomx.com/tags).

### Required Parameters:
* `data-id` - placement ID

### Optional parameters:
* `data-click` - URL to prepend to the click URL to enable tracking
* `data-uv1`, `data-uv2`, `data-uv3` - User Value to pass in to the tag. Can be used to track & report on custom values. Needs to be a whole number between 1 and 4,294,967,295.
* `data-context` - Conversion Callback Context

1 change: 1 addition & 0 deletions builtins/amp-ad.md
Expand Up @@ -88,6 +88,7 @@ resources in AMP. It requires a `type` argument that select what ad network is d
- [Ad Up Technology](../ads/aduptech.md)
- [AMoAd](../ads/amoad.md)
- [AppNexus](../ads/appnexus.md)
- [Atomx](../ads/atomx.md)
- [CA-ProFit-X](../ads/caprofitx.md)
- [Chargeads](../ads/chargeads.md)
- [Colombia](../ads/colombia.md)
Expand Down
6 changes: 6 additions & 0 deletions examples/ads-legacy.amp.html
Expand Up @@ -162,6 +162,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>Atomx</h2>
<amp-ad width=300 height=250
type="atomx"
data-id="1234">
</amp-ad>

<h2>Doubleclick</h2>
<amp-ad width=320 height=50
type="doubleclick"
Expand Down
7 changes: 7 additions & 0 deletions examples/ads.amp.html
Expand Up @@ -67,6 +67,7 @@ <h2>Ad networks in <span class="broken">red color</span> have broken examples, p
<a href="#aduptech">Ad Up Technology</a> |
<a href="#amoad">AMoAd</a> |
<a href="#appnexus">App Nexus</a> |
<a href="#atomx">Atomx</a> |
<a href="#caprofitx">CA ProFit X</a> |
<a href="#chargeads">Chargeads</a> |
<a href="#colombia" class="broken">Colombia ad</a> |
Expand Down Expand Up @@ -247,6 +248,12 @@ <h2 id="appnexus">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 id="atomx">Atomx</h2>
<amp-ad width=300 height=250
type="atomx"
data-id="1234">
</amp-ad>

<h2 id="caprofitx">CA ProFit-X</h2>
<amp-ad
width="320"
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-ad/amp-ad.md
Expand Up @@ -86,6 +86,7 @@ resources in AMP. It requires a `type` argument that select what ad network is d
- [Ad Up Technology](../../ads/aduptech.md)
- [AMoAd](../../ads/amoad.md)
- [AppNexus](../../ads/appnexus.md)
- [Atomx](../../ads/atomx.md)
- [Chargeads](../../ads/chargeads.md)
- [Colombia](../../ads/colombia.md)
- [Criteo](../../ads/criteo.md)
Expand Down

0 comments on commit 11b1af6

Please sign in to comment.