-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 ads: baidu #19489
✨ add ads: baidu #19489
Conversation
The limitation of bundlesize of
|
This PR shouldn't affect the size of v0.js. This may be related:
I restarted the build for you. @danielrozenberg FYI. |
/to @lannka |
Re bundle-size - the base commit on To unblock you we're increasing the max bundle size (ampproject/amphtml-build-artifacts#7), and will manually re-trigger Travis builds on the master branch to create files to store those base sizes for each of the commits that failed so far. Once that's done, we can re-trigger Travis here and it should pass. This should take about ~1-2 hours. Apologies for the hassle! |
Update: |
ads/_config.js
Outdated
@@ -202,6 +202,10 @@ export const adConfig = { | |||
], | |||
}, | |||
|
|||
'baidu': { | |||
prefetch: 'https://dup.baidustatic.com/js/dm.js', | |||
}, |
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.
could you please implement the render-start API?
full guideline
@lannka The |
global.context.renderStart(); | ||
}, | ||
() => { | ||
global.context.noContentAvailable(); |
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.
this only gets called when the script is failed to load.
does dm.js script fire global events when ad response is back? that will be the time to call renderStart or noContentAvailable, depending on if the ad is filled or not.
It would be better, but for now, I made this change 85fd9ca with the reference of the source code of |
does the message tell parent if the ad request returns an ad or not? noContentAvailable should be called when the response is empty. |
Yes, the ad content is in the page. It exists as a JSON, and will be written in the page by JS immediately. The message is a sign of successful loading, no message, no ad. But I don't know how to prevent the disappearance of default AMP ad loading mask until message received. var ad = [
{
"surl" : "gongyi.baidu.com",
"isHb" : "true",
"bid" : "",
"res" : "http://ubmcmm.baidustatic.com/media/v1/0f000F_LSb3bh3jmLIlBS6.png",
"width" : 728,
"height" : 90,
"type" : "image",
}
]; |
Got you, seems tricky then. Would you add a comment to explain that there is no good way to do noContentAvailable call. Otherwise the PR looks good to me. Thanks! |
|
Thanks @PengXing . I meant to have that as JS comment in the code to inform other developers. |
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.
You will want to merge with "master head" to resolve the failing travis test.
examples/ads-legacy.amp.html
Outdated
@@ -492,5 +492,11 @@ <h2>PulsePoint 300x250</h2> | |||
data-size="300X250"> | |||
</amp-ad> | |||
|
|||
<h2>Baidu</h2> |
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.
not needed. this is a legacy file that is deprecated
3p/integration.js
Outdated
@@ -250,6 +250,7 @@ import {zedo} from '../ads/zedo'; | |||
import {zen} from '../ads/zen'; | |||
import {zergnet} from '../ads/zergnet'; | |||
import {zucks} from '../ads/zucks'; | |||
import {baidu} from '../ads/baidu'; |
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.
alphabetical order pls
3p/integration.js
Outdated
@@ -479,6 +480,7 @@ register('zedo', zedo); | |||
register('zen', zen); | |||
register('zergnet', zergnet); | |||
register('zucks', zucks); | |||
register('baidu', baidu); |
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.
alphabetical order
@@ -1336,5 +1337,11 @@ <h2>Zucks</h2> | |||
type="zucks" | |||
data-frame-id="_bda46cf5ac"> | |||
</amp-ad> | |||
|
|||
<h2>Baidu</h2> |
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.
alphabetical order pls
examples/ads.amp.html
Outdated
@@ -235,6 +235,7 @@ | |||
<option>zen</option> | |||
<option>zergnet</option> | |||
<option>zucks</option> | |||
<option>badiu</option> |
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.
one more here
examples/ads.amp.html
Outdated
@@ -1911,5 +1912,11 @@ <h2>Zucks</h2> | |||
data-frame-id="_bda46cf5ac"> | |||
</amp-ad> | |||
|
|||
<h2>Baidu</h2> |
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.
and here
delete preconnect, as it has the same domain with prefetch url
The new `ads.out` is regenerated by running `gulp validator --update-tests`.
Following the guidance of this documentation, [ads README.md](https://github.com/ampproject/amphtml/blob/master/ads/README.md)
Add JS comment to explain why there is no good way to do `noContentAvailable` call.
1. rearrage the code 2. regenerate ads.out
I have completed the modification of all alphabetical order problems. Please check it. The Travis CI build failed caused by failure of dead link check. And the link of baidu ad union website is not dead. Maybe the Travis CI build should be re-run.
|
Tests passed. Merged. |
Thanks a lot. |
* ✨ add ads: baidu * fix lint errors * delete preconnect delete preconnect, as it has the same domain with prefetch url * Update validator test: ads.out The new `ads.out` is regenerated by running `gulp validator --update-tests`. * Implelmentation of renderStart and noContentAvaliable API Following the guidance of this documentation, [ads README.md](https://github.com/ampproject/amphtml/blob/master/ads/README.md) * fix lint errors. * Adjust the timing of invoking renderStart * Add JS comment Add JS comment to explain why there is no good way to do `noContentAvailable` call. * Rearrage the code in alphabetical order 1. rearrage the code 2. regenerate ads.out * Modify a missing alphabetical order problem * Modify a missing alphabetical order problem
Ad an ads:
baidu
.Baidu is an advertising provider in China, and it plays an important role.