Skip to content

Commit

Permalink
AdSense Fast Fetch delay 3 viewport experiment - respect loading stra…
Browse files Browse the repository at this point in the history
…tegy (ampproject#20866)

* initial commit

* modify dep-check

* truly fix dep issue
  • Loading branch information
keithwrightbos authored Feb 14, 2019
1 parent 806db59 commit a751cc7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions build-system/dep-check-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ exports.rules = [
'extensions/amp-ad/0.1/amp-ad-xorigin-iframe-handler.js->extensions/amp-ad-network-adsense-impl/0.1/adsense-a4a-config.js',

// Ads needs concurrent loading
'extensions/amp-ad-network-adsense-impl/0.1/amp-ad-network-adsense-impl.js->extensions/amp-ad/0.1/concurrent-load.js',
'extensions/amp-ad-network-doubleclick-impl/0.1/amp-ad-network-doubleclick-impl.js->extensions/amp-ad/0.1/concurrent-load.js',
'extensions/amp-a4a/0.1/amp-a4a.js->extensions/amp-ad/0.1/concurrent-load.js',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {domFingerprintPlain} from '../../../src/utils/dom-fingerprint';
import {
getAdSenseAmpAutoAdsResponsiveExperimentBranch,
} from '../../../ads/google/adsense-amp-auto-ads-responsive';
import {getAmpAdRenderOutsideViewport} from '../../amp-ad/0.1/concurrent-load';
import {getDefaultBootstrapBaseUrl} from '../../../src/3p-frame';
import {
getExperimentBranch,
Expand Down Expand Up @@ -235,8 +236,10 @@ export class AmpAdNetworkAdsenseImpl extends AmpA4A {

/** @override */
delayAdRequestEnabled() {
return getExperimentBranch(
this.win, DELAY_NUMBER_EXP) == '21063207' ? 3 : true;
if (getExperimentBranch(this.win, DELAY_NUMBER_EXP) != '21063207') {
return true;
}
return getAmpAdRenderOutsideViewport(this.element) || 3;
}

/** @override */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,14 @@ describes.realWin('amp-ad-network-adsense-impl', {
impl.divertExperiments();
expect(impl.delayAdRequestEnabled()).to.equal(3);
});

it('should respect loading strategy in experiment', () => {
impl.element.setAttribute(
'data-loading-strategy', 'prefer-viewability-over-views');
forceExperimentBranch(impl.win, 'adsense-ff-number-delay', '21063207');
impl.divertExperiments();
expect(impl.delayAdRequestEnabled()).to.equal(1.25);
});
});

describe('#preconnect', () => {
Expand Down

0 comments on commit a751cc7

Please sign in to comment.