-
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 SDK integration doc for inabox. #23272
Conversation
ads/inabox/inabox-host.md
Outdated
# SDK integration for AMPHTML ad | ||
One goal of AMPHTML ad is for advertisers to create once and use every where. |
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.
"everywhere"
ads/inabox/inabox-host.md
Outdated
This term describes the situation that an AMPHTML ad is being served | ||
on an non-AMP page inside an iframe embed or in a WebView for native | ||
mobile apps. This is very different from how AMPHTML ad gets rendered |
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.
"how an AMPHTML ad"
ads/inabox/inabox-host.md
Outdated
on an non-AMP page inside an iframe embed or in a WebView for native | ||
mobile apps. This is very different from how AMPHTML ad gets rendered | ||
on an AMP page, as in which case, more sources sharing between the |
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.
incomplete?
ads/inabox/inabox-host.md
Outdated
|
||
###### friendly iframe | ||
An iframe on the host page that has the same origin, so that it has |
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.
"An iframe with the same origin as the host page"
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.
done
ads/inabox/inabox-host.md
Outdated
full access to the host page content. | ||
|
||
###### foreign iframe |
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.
cross-domain ?
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.
done
ads/inabox/inabox-host.md
Outdated
|
||
In the 2nd step, if the ad is generated by a 3rd party, it's a good | ||
idea to run it through an AMP validator to make sure it is valid AMP. |
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.
In cases where the ad network is relying on AMPHTML being trustworthy, running the ad through the validator is more than a good idea!
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.
done
ads/inabox/inabox-host.md
Outdated
`https://cdn.ampproject.org/rtv/{version}/amp4ads-host-v0.js` | ||
1. Before host script is loaded, ads tag is still responsible to queue | ||
up all coming AMP messages into a global array. |
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.
coming -> arriving
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.
done
ads/inabox/inabox-host.md
Outdated
corresponding host script: | ||
`https://cdn.ampproject.org/rtv/{version}/amp4ads-host-v0.js` | ||
1. Before host script is loaded, ads tag is still responsible to queue |
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.
to queue -> for queuing
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.
done
join us to serve and render AMPHTML ad in various environment, for | ||
example regular web & native mobile apps. | ||
|
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.
Mention server-side rendering somewhere?
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.
Hesitated to do so... given it's not really standardized at this moment. It makes quite lot assumption with AMP runtime. There is an on-going effort to open-source some SSR for regular AMP doc. But I don't think it's that ready yet, as nothing about amp4ads is covered.
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.
I think it's worth mentioning that this is in progress, and that if you're looking at serving inabox you should get in touch with the project. Without SSR performance is pretty bad.
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.
added a section for Server side rendering
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.
comments addressed
ads/inabox/inabox-host.md
Outdated
full access to the host page content. | ||
|
||
###### foreign iframe |
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.
done
ads/inabox/inabox-host.md
Outdated
|
||
###### friendly iframe | ||
An iframe on the host page that has the same origin, so that it has |
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.
done
ads/inabox/inabox-host.md
Outdated
|
||
In the 2nd step, if the ad is generated by a 3rd party, it's a good | ||
idea to run it through an AMP validator to make sure it is valid AMP. |
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.
done
ads/inabox/inabox-host.md
Outdated
`https://cdn.ampproject.org/rtv/{version}/amp4ads-host-v0.js` | ||
1. Before host script is loaded, ads tag is still responsible to queue | ||
up all coming AMP messages into a global array. |
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.
done
ads/inabox/inabox-host.md
Outdated
corresponding host script: | ||
`https://cdn.ampproject.org/rtv/{version}/amp4ads-host-v0.js` | ||
1. Before host script is loaded, ads tag is still responsible to queue |
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.
done
ads/inabox/inabox-host.md
Outdated
communicate to the host page via postMessage API. | ||
|
||
## Web SDK (ads tag) integration |
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.
how about JS SDK?
join us to serve and render AMPHTML ad in various environment, for | ||
example regular web & native mobile apps. | ||
|
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.
Hesitated to do so... given it's not really standardized at this moment. It makes quite lot assumption with AMP runtime. There is an on-going effort to open-source some SSR for regular AMP doc. But I don't think it's that ready yet, as nothing about amp4ads is covered.
join us to serve and render AMPHTML ad in various environment, for | ||
example regular web & native mobile apps. | ||
|
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.
I think it's worth mentioning that this is in progress, and that if you're looking at serving inabox you should get in touch with the project. Without SSR performance is pretty bad.
ads/inabox/inabox-host.md
Outdated
1. Add [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) | ||
rules to the ad response to 1) only load JS files from trusted AMP | ||
CDN; 2) disallow iframe embed. |
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.
If you look on a page with GPT you can see Google is currently using:
<meta http-equiv="Content-Security-Policy" content="script-src https://cdn.ampproject.org/;object-src 'none';child-src blob:;frame-src 'none'">
Why not recommend that here? If you're not careful, for example, you can break amp-bind by not allowing workers to be loaded from blobs.
See #21681 where I proposed AMP recommend this CSP.
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.
done
ads/inabox/inabox-host.md
Outdated
CDN; 2) disallow iframe embed. | ||
1. Validate the AMPHTML ad using an AMP validator. There is an open | ||
source JS implementation for the validator. But for performance reason |
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.
reasons
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.
done
ads/inabox/inabox-host.md
Outdated
###### Security assurance | ||
In case that the AMPHTML ad is generated by a 3rd party, to ensure it's | ||
secure to put it in a friendly iframe, the following 2 enforcements |
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.
"enforcements" -> "restrictions" or "protections"
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.
done
ads/inabox/inabox-host.md
Outdated
host script is to be loaded in that case to fulfill the requirements. | ||
|
||
Main work flow: |
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.
workflow
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.
done
* Add SDK integration doc for inabox. * Update * address comments * Fix presumit check * Updates
* Add SDK integration doc for inabox. * Update * address comments * Fix presumit check * Updates
/cc @zombifier (can't add you to reviewer for some reason).