Skip to content
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

[DRAFT] <amp-embed type="insticator"> #23928

Merged
merged 54 commits into from Oct 9, 2019

Conversation

vladdeev
Copy link
Contributor

This is a draft implementation of <amp-embed type=“insticator”>.
The intended functionality is described in #23257.
We need technical advice before going further.

Implementation descriptionю
The <amp-embed> creates an iframe with a boilerplate document inside.
We add three children to the div#c in that document in the following order:
*amp-ad which holds the upper ad
*iframe which holds our embed
*amp-ad which holds the lower ad

cc @lannka

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. 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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@lannka lannka self-requested a review August 13, 2019 19:38
};

// ------- HELPER FUNCTIONS ------- //
function createInitialMarkup() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for flexibility in a long run, I suggest you only leave config related logic in this file, and move logic to /amp-embed-lib/insticator.js as much as possible.

@ortemcheg
Copy link

Currently the ads won’t render because the boilerplate HTML they get appended to is not a valid AMP.
One way to make it work is to use iframes with valid AMP in place of <amp-ad>s. If we take that path we’ll end up with three iframes placed inside of an iframe created by <amp-embed>. We think such an implementation would be ugly, slow and inefficient, so we need to implement it differently. So now we badly need suggestions from the AMP team to help us with implementation. @lannka, could you help?

Because the only alternative way of implementing this functionality that we see now is to consider once again <amp-insticator>, which doesn’t have any nested iframes and uses native <amp-ads> organically.

@triso07
Copy link

triso07 commented Aug 16, 2019

@lannka Any help you can provide on the above would be great. We're starting to get under the gun in terms of our build effort here. Need to start making consistent forward progress now.

@triso07
Copy link

triso07 commented Aug 16, 2019

@lannka Maybe we can just hop on a call if you're open to that? That may speed up the process and make this easier for all of us.

@triso07
Copy link

triso07 commented Aug 19, 2019

@lannka Please advise on the best course of action here

@triso07
Copy link

triso07 commented Aug 21, 2019

@lannka Can we just get on a call to hash this out? We can probably clear this up very quickly and move forward. This starting and stopping of development is hurting our progress and we have very real business needs we're trying to meet here.

@triso07
Copy link

triso07 commented Aug 21, 2019

This back and forth messaging feels a bit slow and unproductive. A call would help expedite this process. We have technical concerns with <amp-embed>. Unless we can resolve those <amp-insticator> seems a much more viable implementation.

@lannka
Copy link
Contributor

lannka commented Aug 21, 2019

sorry for the delay. VC sounds good. Are you in GMT+3? I'm in PST. Try to find a good time for both.

@lannka
Copy link
Contributor

lannka commented Aug 21, 2019

BTW, inside the iframe, why do you still need amp-ad? You can have your own ads tag to retrieve ads. For sake of performance, you might consider server-to-server fetch to reduce client side redirect.

@triso07
Copy link

triso07 commented Aug 21, 2019

Thanks for the response. We're EST. If you have time tomorrow that would be great. How's 4:30pm EST?

@lannka
Copy link
Contributor

lannka commented Aug 22, 2019

chatted over VC, meeting notes:

  • <amp-embed> uses 3rd party iframe, inside the iframe Instricator can do things just like non-AMP pages, with some limitation as noted below
  • To prevent page jump, like any other AMP extension, <amp-embed> is not allowed to resize itself freely. Instead, 3rd party code should call the context API to do resize. The context API also provides a bunch of commonly used API for 3rd party code to retrieve relevant info about the apge.
  • The code snippet that Instricator provides to their customers should look like: <amp-embed type=instricator width=300 height=750>. That said, a predefined size need to be specified.
  • Elements within current viewport are generally not allowed for resize. To increase success rate of a resize, do it as early as possible before user scroll to it.
  • On a resize failure, Instricator can consider to use an overflow button to do a user initiated resize.

triso07 and others added 12 commits August 28, 2019 11:23
Utilizing existing header/body code setup to generate embed and ads
- Cleaned up unnecessary code references
- Removed unnecessary preconnects
- Updated documentation slightly
Dynamically pulling data attributes and fully cleaned up code
Passing top level domain to insticator ads code
@vladdeev
Copy link
Contributor Author

vladdeev commented Oct 7, 2019

Also it seems like there are now a few commits with authors that are not covered by the Google CLA, this will have to be resolved before we can merge.
Screen Shot 2019-10-04 at 9 37 40 AM

hey @calebcordry I added these 2 addresses to the group. Do we need to do anything else to pass this check?

@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@calebcordry
Copy link
Member

Thanks for looking into the CLA. I do see the new emails passing but it looks like a previously ok email is now failing.
image

@triso07
Copy link

triso07 commented Oct 8, 2019

@googlebot I consent.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Oct 8, 2019
@triso07
Copy link

triso07 commented Oct 8, 2019

@calebcordry CLAs signed. We good to go?

validateData(data, ['siteId', 'embedId']);

// create insticator markup
global.document.getElementById('c').appendChild(createTemplate(data['embedId']));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: linter wants these on new lines. If you run gulp lint it will show these errors.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@rcebulko rcebulko self-requested a review October 9, 2019 16:07
@triso07
Copy link

triso07 commented Oct 9, 2019

@calebcordry Great! Thanks! Excited!

@rcebulko
Copy link
Contributor

rcebulko commented Oct 9, 2019

Oddly, requesting the set of reviews from the GitHub API for this PR yields the following series of states:

[ [ 'COMMENTED', 'lannka' ],
  [ 'DISMISSED', 'lannka' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'lannka' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'calebcordry' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'triso07' ],
  [ 'COMMENTED', 'calebcordry' ] ]

Investigating why GitHub thinks you haven't approved @calebcordry

@calebcordry
Copy link
Member

@rcebulko Thanks for investigating.

@triso07 You are welcome. Thanks for being patient on this contribution! FYI we are investigating what is going on with our owners bot, no further changes are needed from you. I will merge when it gets sorted.

@calebcordry calebcordry merged commit cfed375 into ampproject:master Oct 9, 2019
@triso07
Copy link

triso07 commented Oct 17, 2019

@calebcordry @rcebulko Had to make some minor updates to the .md read me file. Sorry for that. Anyway we can review those and merge?

Insticator#26

@calebcordry
Copy link
Member

@triso07 do you have an open PR?

@triso07
Copy link

triso07 commented Oct 18, 2019

@calebcordry We do now ;)

#25103

micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
* UNSTABLE: added new amp-embed type, insticator

* Utilizing our standard header and body code to generate ads (instead of AMP ads)

* Commenting out extraneous helper functions now that we're generating ads the traditional way

* commented out logs

* - Added site id param
- Cleaned up unnecessary code references
- Removed unnecessary preconnects
- Updated documentation slightly

* further cleaning the code

* Changed append location of markup to be more inline with other code. Updated documentation slightly.

* minor text change to documentation

* hooking up to available API and passing top level domain to insticator ads code for passing to providers

* Passing AMP embed API to insticator code so we can resize when needed

* initial round of AMP requested adjustments to our code

* No longer creating script tags then appending them, instead just executing the functions

* removed unnecessary function

* removed extraneous helper function

* changed var to const

* Removing unnecessary library call. Using dummy embed instead of real one.

* Implemented renderStart method per AMP request

* Fixed all reported linting issues

* Embed was not loading correctly before. Using a to reference Insticator object so we pass linter and embed works correctly

* Updated Copyright year

* removed loadScript (thought this was necessary from AMPs side)

* removed import for loadScript since no longer using it

* added /*OK*/ to template as requested

* Removed URL helper var since no longer being used in multiple places. Instead hardcoding URL in string.

* Using /*OK*/ for innerHTML as AMP requires this

* Starting at 850 as that is our standard for embed with ads (resize will be requested if necessary)

* Capitalized E in element

* using bracket notation to reference data attributes per AMP request

* Additional bracket instead of dot notation reference

* forgot the tick marks when accessing property via brackets

* Another NIT linter issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants