Skip to content

Commit

Permalink
Add SMI2 amp-embed (#11254)
Browse files Browse the repository at this point in the history
* Add SMI2 amp-embed

* Add SMI2 amp-embed - Fix AssertionError: expected 'sogouad' to be below smi2

* Add SMI2 amp-embed - Fix AssertionError: expected 'sogouad' to be below smi2 in _config.js

* Add SMI2 amp-embed - Fix Travis IE Errors - disable preconnect
  • Loading branch information
isublimity authored and jridgewell committed Sep 22, 2017
1 parent ddfdf69 commit 3b60020
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ import {sklik} from '../ads/sklik';
import {slimcutmedia} from '../ads/slimcutmedia';
import {smartadserver} from '../ads/smartadserver';
import {smartclip} from '../ads/smartclip';
import {smi2} from '../ads/smi2';
import {sortable} from '../ads/sortable';
import {sogouad} from '../ads/sogouad';
import {sovrn} from '../ads/sovrn';
Expand Down Expand Up @@ -207,6 +208,7 @@ const AMP_EMBED_ALLOWED = {
outbrain: true,
plista: true,
smartclip: true,
smi2: true,
taboola: true,
zergnet: true,
};
Expand Down Expand Up @@ -334,6 +336,7 @@ register('sklik', sklik);
register('slimcutmedia', slimcutmedia);
register('smartadserver', smartadserver);
register('smartclip', smartclip);
register('smi2', smi2);
register('sortable', sortable);
register('sogouad', sogouad);
register('sovrn', sovrn);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,10 @@ export const adConfig = {
renderStartImplemented: true,
},

smi2: {
renderStartImplemented: true,
},

sogouad: {
prefetch: 'https://theta.sogoucdn.com/wap/js/aw.js',
renderStartImplemented: true,
Expand Down
48 changes: 48 additions & 0 deletions ads/smi2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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 {loadScript, validateData} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/

export function smi2(global, data) {
validateData(data, ['blockid']);
(global._smi2 = global._smi2 || {
viewId: global.context.pageViewId,
blockId: data['blockid'],
htmlURL: data['canonical'] || global.context.canonicalUrl,
ampURL: data['ampurl'] || global.context.sourceUrl,
testMode: data['testmode'] || 'false',
referrer: data['referrer'] || global.context.referrer,
hostname: global.window.context.location.hostname,
clientId: window.context.clientId,
domFingerprint: window.context.domFingerprint,
location: window.context.location,
startTime: window.context.startTime,

});
global._smi2.AMPCallbacks = {
renderStart: global.context.renderStart,
noContentAvailable: global.context.noContentAvailable,
};
// load the smi2 AMP JS file script asynchronously
const rand = Math.round(Math.random() * 100000000);
loadScript(global, 'https://amp.smi2.ru/ampclient/ampfecth.js?rand=' + rand, () => {},
global.context.noContentAvailable);
}
39 changes: 39 additions & 0 deletions ads/smi2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!---
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.
-->

# Smi2

SMI2 is a service for personalizing content network.

Please visit our [website](https://smi2.net) for more information about us.

## Examples

```html
<amp-embed height="284"
type="smi2"
data-blockid="90223">
</amp-embed>

```

## Configuration

height and

Required parameters:

- `data-blockid` - insert your block_id
7 changes: 7 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<option>slimcutmedia</option>
<option>smartadserver</option>
<option>smartclip</option>
<option>smi2</option>
<option>sogouad</option>
<option>sortable</option>
<option>sovrn</option>
Expand Down Expand Up @@ -1215,6 +1216,12 @@ <h2>smartclip</h2>
data-sz="400x320">
</amp-ad>

<h2>SMI2</h2>
<amp-embed height="284"
type="smi2"
data-blockid="90223">
</amp-embed>

<h2>sogou ad</h2>
<amp-ad width="20" height="3"
type="sogouad"
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 @@ -318,5 +318,6 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [Dable](../../ads/dable.md)
- [Engageya](../../ads/engageya.md)
- [Outbrain](../../ads/outbrain.md)
- [Smi2](../../ads/smi2.md)
- [Taboola](../../ads/taboola.md)
- [ZergNet](../../ads/zergnet.md)

0 comments on commit 3b60020

Please sign in to comment.