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
Yahoo amp-ad plugin #5122
Yahoo amp-ad plugin #5122
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
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.
we recently added new API: renderStart
Could you take a look and implement the APIs (renderStart + noContentAvailable)?
It helps AMP to provide a better ad loading experience.
Let me know if you have any questions regarding that.
} | ||
|
||
export function yahoo (global, data) { | ||
var cb = done.bind(this, global, data); |
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.
we use 2-space indentation
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.
Updated
yahoo: { | ||
prefetch: [ | ||
'https://s.yimg.com/os/ampad/display.js', | ||
'https://s.yimg.com/os/ampad/gemini.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.
please append trailing ,
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
'https://s.yimg.com/os/ampad/display.js', | ||
'https://s.yimg.com/os/ampad/gemini.js' | ||
], | ||
preconnect: 'https://us.adserver.yahoo.com' |
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.
same here
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
data-sid="954014446" | ||
data-site="news" | ||
data-sa='{"LREC":"300x250","secure":"true","content":"no_expandable;"}'> | ||
</amp-ad> |
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 also add an example for adtype=gemini
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
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ |
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.
pls move the JS doc to the right place
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.
Went ahead and restructured this code a bit.
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
@lannka Since our ad implementation will live externally from this code, I believe we'll have to adopt the By the way, the documentation for |
Hi @lannka - Checking in, anything further need to be done for this one? |
export function yahoo (global, data) { | ||
var cb = (function (global, data) { | ||
export function yahoo(global, data) { | ||
const cb = (function(global, data) { |
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 bound function isn't necessary:
function cb() {
window.ampAdExecute(global, data);
}
// or
const cb = () => {
window.ampAdExecute(global, data);
};
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.
Apologize for the delay.
I cannot get both examples working locally (both are blank).
Could you follow the guidelines and get it work locally?
data-sa='{"LREC":"300x250","secure":"true","content":"no_expandable;"}'> | ||
</amp-ad> | ||
|
||
<h2 id="yahoo-gemini">Yahoo Gemini</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.
id is not needed here. Each ad network will have one ID for navigation.
type="yahoo" | ||
data-sid="954014446" | ||
data-site="news" | ||
data-sa='{"LREC":"300x250","secure":"true","content":"no_expandable;"}'> |
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.
please also add the following tags inside amp-ad
<div placeholder></div>
<div fallback></div>
@src-code render-start is not available in nested iframe yet. Will let you know once its ready. Thanks for your patience. Please address the comments and I will take another look. |
@lannka Thanks, I'll update with fixed examples. Though for the Gemini case, I likely will just pull that out. Gemini is a little different in that it's a native ad which we're rendering inside content populated with amp-list. amp-ad feels like the wrong approach for these ads, since we've already got the ad rendering available, so there's no reason to inject an iframe there (and we want to share styling with the content.) Really the only reason I can find to use amp-ad is for the ad viewability tracking, which doesn't seem to be solvable with the recently-added viewability triggers supported by amp-analytics. I'd hate to use amp-ad as just a tracking pixel in this case, or sticking the whole ad into the placeholder/fallback nodes and letting amp-ad fail silently (if that'd even work?) Curious to know if you've seen other use cases such as this, and have a recommendation for how to best handle this sort of native advertising? |
Using |
@lannka In our case, the ads are co-mingled in the feed that returns article data, which is why they end up rendered by amp-list. In a sense they're just sponsored articles, but with the additional requirement of viewability tracking. There's no need for an ad call since we already have all the data available to us, and we want the rendering to mostly match the other non-ad content. I'm not sure A4A helps for those reasons? |
In a sense, I think what I want is the ability to pass in the rendered ad via a child element such as what's done for |
@src-code @lannka why not submit an embed similar to what Taboola does? |
@jasti We could certainly go the embed route - I'll explore that next, and if it seems promising, open a separate PR. Meanwhile, I'm going to clean this one up a bit. |
@laanka @jasti Actually, now that I think of it, going the embed route would not really help us much - we want to track the visibility of individual stories, not the aggregate. The sponsored stories are intermixed with the non-sponsored stories, so we want to track each sponsored story independently... So it seems like the only way to do that is to make each sponsored story its own amp-ad/amp-embed, but then we're back to the problem of having to feed pre-rendered content to the amp-ad via properties, or using amp-ad only as a tracking pixel - both of which seem wrong. It'd be great if amp-ad would support a rendering option that didn't require an iframe, so we could just wrap existing, simple ad markup that doesn't require its own javascript, only than the amp-ad plugin code to track and beacon visibility. Does that make sense, and would it seem possible? Or is there a better way? |
@src-code Not convinced using amp-ad/embed for each sponsored story is a bad idea. I don't think we could render a non A4A ad without an iframe. |
@jasti Does A4A work outside of iframes? I was under the impression that it must be a fully-formed AMP document, which seems to imply iframes? There's no reason these ads couldn't be A4A, since they're just plain markup without javascript, but if they have to be iframed then it doesn't seem to help me much. My primary goal is to avoid iframes so I can take advantage of existing page styling, but I still need viewability tracking. Maybe what's needed then is an enhancement to amp-analytics visibility tracking? Having the ability to track these elements in a more fine-grained fashion (eg by class rather than id or tag), and firing a separate beacon for each matching element, even for content injected late via amp-list, would be sufficient for what I'm trying to do... |
@src-code A4A is in a same-origin iframe. If you put For CSS sharing, @dvoytenko do we currently have a way to pass CSS to A4A? |
As I understand it, amp-analytics will only match on id or tag name, so there's no good way to match a set of ads of a particular type, as I'd need here (I'd want to write a selector like But it's a moot issue, because if I'm going to use an amp-ad plugin anyway, the viewability tracking becomes easy since I can use the |
Sure. The HTML is allowed to contain |
In some ways, it seems like #5541 is similar to what I'd want (no iframe on amp-ad) but I'd want to avoid the network request (I already have the markup) and I'd want to track the visibility somehow (enhancements to amp-analytics to allow selectors to match multiple nodes, including nodes rendered via amp-list, and beacon as each becomes visible.) |
@lannka My ads are almost pure image ads - they just have a couple lines of text in addition to a single image. So the need is quite similar, I think. Actually I have another proposal I am working on for a change to amp-ad that'll solve this, and I will open an issue to discuss. I hacked around in amp-ad yesterday and got it working pretty easily, and seems to solve my issues without having go overcomplicate things with A4A and amp-analytics. Will post more soon... |
This PR diverged a bit with all the discussion about native ads, so I'm going to close it out in favor of a fresh PR dedicated solely to Yahoo display ads. |
Initial support for Yahoo display and Gemini ads via amp-ad plugin.