-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag '1454726798143' from canary into release
- Loading branch information
Showing
86 changed files
with
2,615 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* Copyright 2015 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, validateSrcPrefix, validateExactlyOne} from '../src/3p'; | ||
|
||
// Valid adform ad source hosts | ||
const hosts = { | ||
track: 'https://track.adform.net/', | ||
adx: 'https://adx.adform.net/' | ||
}; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function adform(global, data) { | ||
|
||
validateExactlyOne(data, ['src', 'bn', 'mid']); | ||
global.Adform = {ampData: data}; | ||
const src = data.src; | ||
const bn = data.bn; | ||
const mid = data.mid; | ||
let url; | ||
|
||
// Custom ad url using "data-src" attribute | ||
if (src) { | ||
validateSrcPrefix(Object.keys(hosts).map(type => hosts[type]), src); | ||
url = src; | ||
} | ||
// Ad tag using "data-bn" attribute | ||
else if (bn) { | ||
url = hosts.track + 'adfscript/?bn=' + encodeURIComponent(bn) + ';msrc=1'; | ||
} | ||
// Ad placement using "data-mid" attribute | ||
else if (mid) { | ||
url = hosts.adx + 'adx/?mid=' + encodeURIComponent(mid); | ||
} | ||
|
||
writeScript(global, url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!--- | ||
Copyright 2015 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. | ||
--> | ||
|
||
# Adform | ||
|
||
Please refer to [Adform Help Center](http://help.adform.com) for more | ||
information on how to get required ad tag or placement IDs. | ||
|
||
## Examples | ||
|
||
### Simple ad tag with `data-bn` | ||
|
||
```html | ||
<amp-ad width=320 height=50 | ||
type="adform" | ||
data-bn="12345"> | ||
</amp-ad> | ||
``` | ||
|
||
### Ad placement with `data-mid` | ||
|
||
```html | ||
<amp-ad width=320 height=50 | ||
type="adform" | ||
data-mid="12345"> | ||
</amp-ad> | ||
``` | ||
|
||
### Ad tag or placement with `src` | ||
|
||
```html | ||
<amp-ad width=320 height=50 | ||
type="adform" | ||
src="https://track.adform.net/adfscript/?bn=4849385;msrc=1"> | ||
</amp-ad> | ||
``` | ||
|
||
### Supported parameters | ||
|
||
- `data-bn` | ||
- `data-mid` | ||
- `src` | ||
|
||
Only one of the mentioned parameters should be used at the same time. | ||
|
||
The `src` parameter must use **https** protocol and must be from one of the | ||
allowed hosts: | ||
|
||
- `https://track.adform.net/...` | ||
- `https://adx.adform.net/...` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright 2015 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} from '../src/3p'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function dotandads(global, data) { | ||
global.data = data; | ||
writeScript(global, 'https://amp.ad.dotandad.com/dotandadsAmp.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!--- | ||
Copyright 2015 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. | ||
--> | ||
|
||
# DotAndAds | ||
|
||
## Example | ||
|
||
300x250 box: | ||
```html | ||
<amp-ad width=300 height=250 | ||
type="dotandads" | ||
data-sp="300x250-u" | ||
data-mpo="ampTest" | ||
data-mpt="amp-amp-all-all"> | ||
</amp-ad> | ||
``` | ||
|
||
980x250 masthead: | ||
```html | ||
<amp-ad width=980 height=250 | ||
type="dotandads" | ||
data-sp='sn-u' | ||
data-cid="11" | ||
data-mpo="ampTest" | ||
data-mpt="amp-amp-all-all"> | ||
</amp-ad> | ||
``` | ||
|
||
## Configuration | ||
|
||
For semantics of configuration, please see ad network documentation. | ||
|
||
Supported parameters: | ||
|
||
- sp: sizepos (the ad size and position code) | ||
- mpo: multipoint (an extraction parameter based on site) | ||
- mpt: mediapoint tag (the box where the ad will be shown) | ||
- cid: customer id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright 2015 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} from '../src/3p'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function smartadserver(global, data) { | ||
loadScript(global, 'https://ec-ns.sascdn.com/diff/js/smart.js', () => { | ||
if (!global.document.getElementById(data.tag)) { | ||
const divElt = global.document.createElement('div'); | ||
divElt.Id = data.tag; | ||
const cElt = global.document.getElementById('c'); | ||
cElt.appendChild(divElt); | ||
} | ||
global.sas.cmd.push(function() { | ||
global.sas.setup({'domain': data.domain, 'async': true}); | ||
}); | ||
global.sas.cmd.push(function() { | ||
global.sas.call(data.call, { | ||
'siteId': data.site, | ||
'pageId': data.page, | ||
'formatId': data.format, | ||
'target': data.target, | ||
'tagId': data.tag | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.