Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admanmedia ad network type added #8052

Merged
merged 11 commits into from
May 26, 2017
2 changes: 2 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {adgeneration} from '../ads/adgeneration';
import {adhese} from '../ads/adhese';
import {adition} from '../ads/adition';
import {adman} from '../ads/adman';
import {admanmedia} from '../ads/admanmedia';
import {adreactor} from '../ads/adreactor';
import {adsense} from '../ads/google/adsense';
import {adsnative} from '../ads/adsnative';
Expand Down Expand Up @@ -220,6 +221,7 @@ register('adgeneration', adgeneration);
register('adhese', adhese);
register('adition', adition);
register('adman', adman);
register('admanmedia', admanmedia);
register('adreactor', adreactor);
register('adsense', adsense);
register('adsnative', adsnative);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export const adConfig = {

adman: {},

admanmedia: {
renderStartImplemented: true,
},

adreactor: {},

adsense: {
Expand Down
34 changes: 34 additions & 0 deletions ads/admanmedia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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 {validateData, loadScript} from '../3p/3p';

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

loadScript(global, `https://mona.admanmedia.com/go?id=${data.id}`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use encodeURIComponent(data.id)

const pattern = `script[src$="id=${data.id}"]`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encodedId here as well?

const scriptTag = global.document.querySelector(pattern);
scriptTag.setAttribute('id', `hybs-${data.id}`);
global.context.renderStart();
}, () => {
global.context.noContentAvailable();
});
}
33 changes: 33 additions & 0 deletions ads/admanmedia.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!---
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.
-->

# Admanmedia

Please visit our web (http://www.admanmedia.com) for more details
## Example

```html
<amp-ad width="300" height="250"
type="admanmedia"
data-id="8e916419">
</amp-ad>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation here.

```

## Configuration

__Required:__

- `data-id` - Adunit unique id
9 changes: 8 additions & 1 deletion examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<option>adgeneration</option>
<option>adhese</option>
<option>adman</option>
<option>admanmedia</option>
<option>adreactor</option>
<option>adsense</option>
<option>adsnative</option>
Expand Down Expand Up @@ -265,6 +266,12 @@ <h2>Adman</h2>
data-host="talos.adman.gr">
</amp-ad>

<h2>AdmanMedia</h2>
<amp-ad width="300" height="250"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get error when testing locally. Could you please take a look?
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing locally, as the mona.admanmedia.com does not set specially CORS headers for localhost, I am launching Chrome like this: ./chrome --disable-web-security --user-data-dir
Prior to launching it to production we will setup CORS headers on our server and this error will not be launched anymore

Copy link
Contributor

@zhouyx zhouyx May 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool I am able to see it now. After this PR has been merged it usually takes two weeks for it to hit prod. It's usually towards the end of a week, but not always on an exact data. Is there a concern why you can't setup the header a bit earlier?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you valuable remarks that helped us improve the code quality. We have started the internal process for CORS header setting and hopefully in a few days we will be all set.

type="admanmedia"
data-id="8e916419">
</amp-ad>

<h2>AdReactor</h2>
<amp-ad width="728" height="90"
type="adreactor"
Expand Down Expand Up @@ -639,7 +646,7 @@ <h2>FlexOneHARRIER</h2>
data-section-id="2267"
data-slot="2843">
</amp-ad>

<h2>Felmat</h2>
<amp-ad width="300" height="250"
type="felmat"
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 @@ -192,6 +192,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [Adhese](../../ads/adhese.md)
- [ADITION](../../ads/adition.md)
- [Adman](../../ads/adman.md)
- [AdmanMedia](../../ads/admanmedia.md)
- [AdReactor](../../ads/adreactor.md)
- [AdSense](../../ads/google/adsense.md)
- [AdsNative](../../ads/adsnative.md)
Expand Down