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

Amp-Ad upgrade: move remote.html existence check before network predicate execution #8249

Merged
merged 1 commit into from Mar 20, 2017
Merged

Amp-Ad upgrade: move remote.html existence check before network predicate execution #8249

merged 1 commit into from Mar 20, 2017

Conversation

keithwrightbos
Copy link
Contributor

For Fast Fetch network support selection within AmpAd element, a predicate is registered within the network config that when executed returns whether Fast Fetch flow should be used. In the case of AdSense & Doubleclick, the function execution includes selection into control or experiment to isolate the impact of Fast vs Delayed Fetch. Currently Fast Fetch does not support remote.html usage due to its nature of being custom JS and as such should be carved out of valid traffic for Fast Fetch selection. This check was moved out of Doubleclick specific predicate to general AmpAd upgrade within #8248 when it was discovered that publishers were also using remote.html for AdSense. However, when it was moved, it was placed AFTER the predicate execution causing selection into the Fast Fetch experiment to not actually result in a Fast Fetch request.

cc @ampproject/a4a

@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to lannka zhouyx

  • extensions/amp-ad/0.1/amp-ad.js
  • extensions/amp-ad/0.1/test/test-amp-ad.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@keithwrightbos keithwrightbos changed the title Amp-Ad upgrade: vove remote.html existence check before network predicate execution Amp-Ad upgrade: move remote.html existence check before network predicate execution Mar 20, 2017
@@ -76,8 +76,8 @@ export class AmpAd extends AMP.BaseElement {

// TODO(tdrl): Check amp-ad registry to see if they have this already.
if (!a4aRegistry[type] ||
!a4aRegistry[type](this.win, this.element) ||
this.win.document.querySelector('meta[name=amp-3p-iframe-src]')) {
this.win.document.querySelector('meta[name=amp-3p-iframe-src]') ||
Copy link

Choose a reason for hiding this comment

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

Nit: I would put this check very first, so that the a4aRegistry[type] goes right beside a4aRegistry[type](this.win, this.element), which is the more common idiom I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put it this way for minuscule performance reason where presumably the check for type existence in the config object is much less expensive than querying the DOM for remote.html meta existence.

!a4aRegistry[type](this.win, this.element) ||
this.win.document.querySelector('meta[name=amp-3p-iframe-src]')) {
this.win.document.querySelector('meta[name=amp-3p-iframe-src]') ||
!a4aRegistry[type](this.win, this.element)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we fix the side effect of this function call? or somehow give it a clearer naming.

@lannka lannka merged commit 42e2df3 into ampproject:master Mar 20, 2017
@taymonbeal taymonbeal deleted the a4a_remote_predicate branch March 20, 2017 21:07
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants