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
Intent to implement: support custom ad (house ad) served from pub's own server #5541
Comments
@lannka Could this be implemented as a special A4A implementation that is upgraded from A few things:
|
I'm not sure it's a good idea to mix this image ad concept with A4A, and I also don't know how much code can be shared between the 2. To me, a separate upgrade path would be a cleaner approach. I agree with your other points. For URL replacement on dest URL, what major use cases are you thinking of? I think we can probably enable it later when requirements are clear. |
All sounds good. On Wed, Oct 12, 2016 at 2:32 PM, Hongfei Ding notifications@github.com
|
OK, so I'm making good progress and I have a basic ad object working, albeit still missing a bunch of stuff. I'm not using A4A, which would in any case be way too complex for me to learn. I need a steer on a few things, however: (1) I'm trying to provide the facility that when an ad is clicked on, a call is made to Google Analytics to record the event. I can do this from cold easily enough, but I assume that it would be better to use (2) I'm (obviously) going to add something into examples/ads.amp.html, which will need an example ad server. Shall I just use my own production ad server to do this? Or is there an approved place in the AMP world where I can put a couple of files that will be accessed by (3) Is it best for me to not push anything until the code is what I would consider to be production ready, or to push some code early on (with a bunch of |
No code needed for this purpose. Publisher can just setup
No external server needed for this case. We can use the local gulp server. Changes in this file is expected.
TODO is totally fine. Actually small PR is appreciated. |
Hi folks - I'm ready to do my first PR (which is also my first ever PR on Github). I'm trying to do it from Github on the Mac, which is telling me "Authentication Failed - You may not have permission to access amphtml". Can someone give me the appropriate permission? btw Will be away from tomorrow for a week, but will try again on my return. @lannka - any more detail on how to amend the server.js would be a appreciated - my first attempt resulted in 404 errors. |
@xgretsch there's no permission check if you do
server.js is using express.js. You'll do something like:
then, you should be able to get the JSON response in your browser: http://localhost:8000/path-to-your-ad |
@lannka OK, thanks. I thought that's what I did, so I must have got something misconfigured. I'm out of town until Friday, will investigate then. Probably need to try git from the command line without using the Github app. |
Per discussion in the other thread (#5721), I'm thinking of expanding the use case to beyond pure image ad. It's still an XHR request returning a JSON object, but we let publisher to render the ad using a template (such as amp-mustache). The image ad use case becomes: <amp-ad type="custom" width="300" height="250"
data-url="https://adserver.com/ad?pubId=1234&slotId=5678&width=300&height=250">
<div content>
<template type="amp-mustache">
<a href="{{clickUrl}}">
<amp-img src="{{adSrc}}"></amp-img>
</a>
</template>
</div>
</amp-ad> We can allow pub compose the adrequest There shouldn't be new security concern since all the building blocks are already there (very similar to amp-list). For instance, I suppose Of course, the supporting ad server will need to implement CORS. @xgretsch @jasti @cramforce thoughts? |
This is fairly bare-bones: still needs converting the example ad server from one on pbl.bachtrack.com to one on the test server, and still needs some tests implemented.
@lannka As you've seen, I've just managed my first PR. I hadn't understood the requirement to fork the project first. I have no objection to imagead being changed to implement a template engine - in which case it would make sense to call it "custom" instead of "imagead". However, I don't how much work it would take to do: I've never used mustache before. I'll take a quick look at it, but it would be nice if you could look at the PR in the mean time. |
@xgretsch I'm wondering: Did you take a look at |
@cramforce I have to admit, I hadn't - |
@xgretsch Sorry about that. Yeah, the name is stupid. Could you take the time to take a deeper look? Introducing concepts to AMP is very expensive to us (docs, maintenance, developers have to understand them), so if an existing concept can work, that would be great. We will rename |
I mean, it is a good question as to whether we should do this, if amp-list On Thu, Oct 20, 2016 at 9:20 PM, Malte Ubl malte.ubl@gmail.com wrote:
|
amp-list (badly named, I repeat myself) can already do that, no? On Thu, Oct 20, 2016 at 8:29 PM, Hongfei Ding notifications@github.com
|
But regardless to it, I still think we should recommend all ads content displayed in |
So in theory, either |
* First implementation of imagead (intent to implement #5541) This is fairly bare-bones: still needs converting the example ad server from one on pbl.bachtrack.com to one on the test server, and still needs some tests implemented. * Sample JSON for imagead now in examples directory Previously, there was a dependency on an external ad server for the example imagead to work. This is now gone. * Fix Travis errors, get rid of global Uses of global.xxx changed to win.this.xxx as requested by @lannka at code review. * Separate out the ad batch manager The batch manager is now in a separate class. * Moved getBatchManager into the batch manager file This ensures that all batch manager related stuff is nicely separated out. * Fix blatant errors in getBatchManager * Add support for mustache templates, cleaned up lint errors * Several edits suggested by @lannka at code review Scanning of the document now only done once. Redundant callback passing now removed. Batch manager is now more general. Experiment check now turned on. Example has placeholder and fallback. Stray yahoo config removed. * Fixed lint errors * Removed default template and accompanying data-target variable * Latest batch of code review requests from @lannka * First batch of changes for @jridgewell code review * Got rid of use of e.win * Don't pass the element to the batch manager constructor, only its URL is needed * Next batch of code review items, mainly from @jridgewell Still not done: investigate getting rid of data-slot, use of timer module, use of “deferred XHR”, investigate further use of promises * Code review changes: rewrite to use promises properly amp-ad-batch-manager.js is no longer needed and has been deleted. * Next batch of code review fixes from @jridgewell * Rename imagead to custom * Next batch of @lannka code review comments * Implemented special case for ad slot not specified * Eliminate stray console.log statement * Implemented a unit test for getFullUrl_() * Next batch of @lannka code review changes In particular, incorporate the new AmpAdUIHandler code, plus tidying up of JSON examples. * Added ad-type-custom to experiments.js * Add file amp-ad-ui.js * Add some types to the commenting This is an attempt to get rid of some of the travis errors. * Next Travis error: unlayoutCallback was missing a return statement * Fixed some errors from gulp presubmit * Minor fixes to custom.md and to template rendering
Anything happening with this? I need an easy way to test custom amp-ads locally and was hoping this was the solution! |
Yes - see [https://github.com/ampproject/amphtml/blob/master/ads/custom.md]. It's still labelled "experimental", but it's in production and enabled 100%. See my site [https://bachtrack.com] to look at it in action - go to any article, review or listing page and click "mobile version". |
This is great, thanks! |
@xgretsch I checked out the custom docs and have a question for you. We want to be able to inject an iframe instead of an image like you have in your demo. Im assuming that i can do something like: <amp-ad width=300 height=250
type="custom"
data-url="https://mysite/my-ad-server">
<template type="amp-mustache" id="amp-template-id">
<amp-iframe layout='fixed' height="300" width="250" src="{{src}}"></amp-iframe>
</template>
</amp-ad> The question is, will i have access to |
This is specifically not for iframes. For iframes the only available option that gets access to ad related info is to use |
Hmm... is there a way to render a custom iframe in <amp-ad src='/route/to/my/iframe'></amp-ad> Thanks for your help! |
@orrybaram What are you actually trying to do? Like what do you want to render in the iframe? |
@cramforce |
@orrybaram Lets move this to a new issue. I'd like to understand why you can't use |
…ampproject#5751) * First implementation of imagead (intent to implement ampproject#5541) This is fairly bare-bones: still needs converting the example ad server from one on pbl.bachtrack.com to one on the test server, and still needs some tests implemented. * Sample JSON for imagead now in examples directory Previously, there was a dependency on an external ad server for the example imagead to work. This is now gone. * Fix Travis errors, get rid of global Uses of global.xxx changed to win.this.xxx as requested by @lannka at code review. * Separate out the ad batch manager The batch manager is now in a separate class. * Moved getBatchManager into the batch manager file This ensures that all batch manager related stuff is nicely separated out. * Fix blatant errors in getBatchManager * Add support for mustache templates, cleaned up lint errors * Several edits suggested by @lannka at code review Scanning of the document now only done once. Redundant callback passing now removed. Batch manager is now more general. Experiment check now turned on. Example has placeholder and fallback. Stray yahoo config removed. * Fixed lint errors * Removed default template and accompanying data-target variable * Latest batch of code review requests from @lannka * First batch of changes for @jridgewell code review * Got rid of use of e.win * Don't pass the element to the batch manager constructor, only its URL is needed * Next batch of code review items, mainly from @jridgewell Still not done: investigate getting rid of data-slot, use of timer module, use of “deferred XHR”, investigate further use of promises * Code review changes: rewrite to use promises properly amp-ad-batch-manager.js is no longer needed and has been deleted. * Next batch of code review fixes from @jridgewell * Rename imagead to custom * Next batch of @lannka code review comments * Implemented special case for ad slot not specified * Eliminate stray console.log statement * Implemented a unit test for getFullUrl_() * Next batch of @lannka code review changes In particular, incorporate the new AmpAdUIHandler code, plus tidying up of JSON examples. * Added ad-type-custom to experiments.js * Add file amp-ad-ui.js * Add some types to the commenting This is an attempt to get rid of some of the travis errors. * Next Travis error: unlayoutCallback was missing a return statement * Fixed some errors from gulp presubmit * Minor fixes to custom.md and to template rendering
…ampproject#5751) * First implementation of imagead (intent to implement ampproject#5541) This is fairly bare-bones: still needs converting the example ad server from one on pbl.bachtrack.com to one on the test server, and still needs some tests implemented. * Sample JSON for imagead now in examples directory Previously, there was a dependency on an external ad server for the example imagead to work. This is now gone. * Fix Travis errors, get rid of global Uses of global.xxx changed to win.this.xxx as requested by @lannka at code review. * Separate out the ad batch manager The batch manager is now in a separate class. * Moved getBatchManager into the batch manager file This ensures that all batch manager related stuff is nicely separated out. * Fix blatant errors in getBatchManager * Add support for mustache templates, cleaned up lint errors * Several edits suggested by @lannka at code review Scanning of the document now only done once. Redundant callback passing now removed. Batch manager is now more general. Experiment check now turned on. Example has placeholder and fallback. Stray yahoo config removed. * Fixed lint errors * Removed default template and accompanying data-target variable * Latest batch of code review requests from @lannka * First batch of changes for @jridgewell code review * Got rid of use of e.win * Don't pass the element to the batch manager constructor, only its URL is needed * Next batch of code review items, mainly from @jridgewell Still not done: investigate getting rid of data-slot, use of timer module, use of “deferred XHR”, investigate further use of promises * Code review changes: rewrite to use promises properly amp-ad-batch-manager.js is no longer needed and has been deleted. * Next batch of code review fixes from @jridgewell * Rename imagead to custom * Next batch of @lannka code review comments * Implemented special case for ad slot not specified * Eliminate stray console.log statement * Implemented a unit test for getFullUrl_() * Next batch of @lannka code review changes In particular, incorporate the new AmpAdUIHandler code, plus tidying up of JSON examples. * Added ad-type-custom to experiments.js * Add file amp-ad-ui.js * Add some types to the commenting This is an attempt to get rid of some of the travis errors. * Next Travis error: unlayoutCallback was missing a return statement * Fixed some errors from gulp presubmit * Minor fixes to custom.md and to template rendering
Hi, |
Think this launched and can be closed. Pleas reopen if that's not the case. |
Following the discussion #5442, we want to introduce a new amp-ad impl to support simple image ads served from a custom server. It will not live in an 3P iframe, but rather have simple structure like
<a><img></a>
. It will load the image src URL and click landing page URL via a single XHRThe tentative HTML will look like:
Implementation plan:
AmpAdCustom
at/extensions/amp-ad/0.1/amp-ad-custom.js
.upgradeCallback
of/extensions/amp-ad/0.1/amp-ad.js
.@cramforce please confirm if the above plan makes sense
@xgretsch thank you for volunteering. let me know if there's anything unclear.
The text was updated successfully, but these errors were encountered: