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
✨Add RnetPlus ad exchange support to amp-ad #22024
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: 2019 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
* | ||
* 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, validateSrcPrefix} from '../3p/3p'; | ||
|
||
const jsnPrefix = 'https://api.rnet.plus/'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function rnetplus(global, data) { | ||
validateData(data, ['src']); | ||
const {src} = data; | ||
validateSrcPrefix(jsnPrefix, src); | ||
createContainer(global, 'rnetplus_' + getBlockId(src)); | ||
loadScript(global, src); | ||
} | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {string} renderTo | ||
*/ | ||
function createContainer(global, renderTo) { | ||
const d = global.document.createElement('div'); | ||
d.id = renderTo; | ||
global.document.getElementById('c').appendChild(d); | ||
} | ||
|
||
/** | ||
* @param {string} src | ||
* @return {string} | ||
*/ | ||
function getBlockId(src) { | ||
const parts = src.split('?'); | ||
const vars = parts[1].split('&'); | ||
for (let j = 0; j < vars.length; ++j) { | ||
const pair = vars[j].split('='); | ||
if (pair[0] == 'blockId') { | ||
return pair[1]; | ||
} | ||
} | ||
return '660'; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!--- | ||
Copyright 2017 The AMP HTML Authors. All Rights Reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: 2019 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
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. | ||
--> | ||
|
||
# RnetPlus | ||
|
||
Provides support for [rnetplus](https://admin.rnet.plus/help/) Rambler&Co RNetPlus. | ||
|
||
## Example | ||
|
||
```html | ||
<amp-ad width="250" height="250" | ||
type="rnetplus" | ||
src="https://api.rnet.plus/Scripts/rnet_amp_embed.js?blockId=660"> | ||
</amp-ad> | ||
``` | ||
|
||
## Configuration | ||
|
||
For details on the configuration semantics, please contact [Rambler](https://admin.rnet.plus/). | ||
|
||
### Required parameters | ||
|
||
- `src` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,7 @@ | |
<option>revcontent</option> | ||
<option>revjet</option> | ||
<option>rfp</option> | ||
<option>rnetplus</option> | ||
<option>rubicon</option> | ||
<option>runative</option> | ||
<option>sas</option> | ||
|
@@ -1580,6 +1581,13 @@ <h2>Rambler&Co</h2> | |
json='{"params":{"p1":"bvpkq","p2":"y","pct":"a"}}'> | ||
</amp-ad> | ||
|
||
<h2>Rambler&Co RNetPlus</h2> | ||
<amp-ad width="300" height="400" | ||
type="rnetplus" | ||
layout="responsive" | ||
src="https://api.rnet.plus/Scripts/rnet_amp_embed.js?blockId=660"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is up to you but you may want to hardcode this url, and have the block-id be a separate attribute? May be less likely for your users to break. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, it is little bit In few words, without RNetPlus team, you have no chances to place certain As result, RNetPlus Team is always involved into embedding the teasers and it provides the code snippets to place teasers for AMP case and for casual web cases. It means the exact form is not important. But if the form will be important for somebody I able to redesign this piece, thank you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM. |
||
</amp-ad> | ||
|
||
<h2>RbInfox</h2> | ||
<amp-embed width="240" height="400" | ||
type="rbinfox" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, preload/prefetch are popular options here if you know your creative will be requesting a certain file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, but from the technical manner we have JSONP request and it cannot be precached. The images and other stuff are relied to server response and we cannot prefetch it too... Anyway I'll review code to think if we still have something to declare, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.