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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Add 'no-fill' attribute from AdsenseNetworkConfig. #22956

Merged
merged 8 commits into from Jun 24, 2019

Conversation

aishwaryavora
Copy link
Contributor

  • Adding new method in AdsenseNetworkConfig to get sticky ads attributes like 'no-fill'.
  • Updating anchor ad strategy to add sticky ad attributes on amp ad element.

/**
* Returns the sticky ad attributes that should be applied on sticky ad.
* @param {!JsonObject} unusedConfigObj
* @return {JsonObject<string, string>} null if there is no sticky ad attributes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need all of this here? Instead can you put attribute extraction for sticky ads solely within AnchorAdStrategy? All you need is the config which is accessible there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'no-fill' attribute is specifically related to Adsense network so to keep it under Adsense network config, I moved logic here. Also making it in more generalise way so in the future if any other attributes that we might want to apply on sticky ads can be under Adsense config. It will avoid isAdsense check at other places.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want this logic to live client-side, then I think what @aishwaryavora is doing here is the right approach. We are introducing the concept of a non-filled sticky ad request and also a data-no-fill attribute. Since this (at the moment) is an AdSense only concepts, it makes sense to keep the logic for it in the AdSenseNetworkConfig and not pollute the generalized amp-auto-ads code with isAdsense checks.

Another approach that was discussed, would be to just add a new field in the config that contains attributes that are specific to the anchor ad strategy. We would then not require the new OptInStatus or any of this logic client-side. All the decision logic about whether to enable anchor and whether a data-no-fill attribute should be used could then live in the ad server.

extensions/amp-auto-ads/0.1/ad-network-config.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/amp-auto-ads.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/anchor-ad-strategy.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/anchor-ad-strategy.js Outdated Show resolved Hide resolved
/**
* Returns the sticky ad attributes that should be applied on sticky ad.
* @param {!JsonObject} unusedConfigObj
* @return {JsonObject<string, string>} null if there is no sticky ad attributes.
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want this logic to live client-side, then I think what @aishwaryavora is doing here is the right approach. We are introducing the concept of a non-filled sticky ad request and also a data-no-fill attribute. Since this (at the moment) is an AdSense only concepts, it makes sense to keep the logic for it in the AdSenseNetworkConfig and not pollute the generalized amp-auto-ads code with isAdsense checks.

Another approach that was discussed, would be to just add a new field in the config that contains attributes that are specific to the anchor ad strategy. We would then not require the new OptInStatus or any of this logic client-side. All the decision logic about whether to enable anchor and whether a data-no-fill attribute should be used could then live in the ad server.

extensions/amp-auto-ads/0.1/anchor-ad-strategy.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/amp-auto-ads.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/opt-in-status.js Outdated Show resolved Hide resolved
extensions/amp-auto-ads/0.1/attributes.js Show resolved Hide resolved
if (!isObject(configObj['attributes']) || isArray(configObj['attributes'])) {
user().warn(TAG, 'attributes property not an object');
if (!isObject(configObj[attributes]) || isArray(configObj[attributes])) {
user().warn(TAG, attributes + ' property not an object');
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: ${attributes} property not an object

@keithwrightbos keithwrightbos merged commit e489418 into ampproject:master Jun 24, 2019
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
* Wrap 'no-fill' attribute under AdsenseNetworkConfig.

* Wrap no-fill attribute under AdsenseNetworkConfig

* resolve violation errors.

* Adding sticky ad attributes from config object.

* Adding enum for attributes of different ad formats.

* updating getAttributesFromConfigObj from placement.js.

* Updating amp auto ads MD file.
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

4 participants