-
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.
* 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
1 parent
ddfdf69
commit 3b60020
Showing
6 changed files
with
102 additions
and
0 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
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); | ||
} |
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,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 |
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