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

Size Mapping V2 #4520

Closed
wants to merge 38 commits into from
Closed

Size Mapping V2 #4520

wants to merge 38 commits into from

Conversation

Fawke
Copy link
Contributor

@Fawke Fawke commented Dec 2, 2019

The core feature has been implemented.

  • How to test it?

  • Edit the hello_world.html file, and replace it with an adUnit object containing the sizeConfig V2 specs. You can get hold of those objects from I2I, here. I2I - updates and new logic for sizeConfig feature #4129

  • Currently, the workflow (how to reach and activate this module) is not in place. I've currently created a hook on getBids function in adapterManager.js, and that hooked function is getting called for client side adapters only, at the present moment.

  • I've disabled the function checkAdUnitSetup temporarily in Prebid.js file to make this work.

  • The hello_world example has been modified with a simple adUnit setup with sizeMapping V2 specs to check the code. Later, will create a dedicated html example for this new feature.

  • Known Bugs

  1. Bidder level sizeConfigs are working weirdly. When sizeConfig disables the bid, the bid is coming as undefined. This should not happen.
  2. Haven't yet put checks in place to verify if the structure of the sizeConfig object received is correct or not. So, if we give some object in sizeConfig, not properly configured, the behaviour is unstable.

EDIT:

  • Q: How to test it?

  • Check the folder sizeMappingV2 under integrationExamples -> gpt, different scenarios has been already defined there. You can edit them to your liking to test edge cases and other scenarios.

  • The Workflow is working End-To-End. The feature is complete.

  • checkAdUnitSetup in prebid.js is hooked onto in sizeMappingV2 module to check the sizeConfig object.

  • All Known Bugs mentioned above has been resolved.

  • Pending Tasks:

    • Writing unit tests.
    • Documentation in Prebid.org

Known Issue

If banner and video mediaTypes, both somehow gets filtered out, adUnits.sizes is set to an empty array. Due to this, some bidder adapters may complain.

@Fawke Fawke changed the title Adv size config Size Mapping V2 Dec 2, 2019
@Fawke
Copy link
Contributor Author

Fawke commented Dec 4, 2019

@jsnellbaker @jaiminpanchal27

Modified checkAdUnitSetup function to check for the new sizeConfig object.

@lgtm-com
Copy link

lgtm-com bot commented Dec 4, 2019

This pull request introduces 1 alert when merging 4b876a6 into aba3689 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Dec 5, 2019

This pull request introduces 1 alert when merging c7b3816 into 7777359 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Dec 6, 2019

This pull request introduces 3 alerts when merging cbf2a61 into 7777359 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class
  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Dec 6, 2019

This pull request introduces 3 alerts when merging 60847f0 into 7777359 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class
  • 1 for Comparison between inconvertible types

@lgtm-com
Copy link

lgtm-com bot commented Dec 8, 2019

This pull request introduces 1 alert when merging eeb07e7 into 8e12e5f - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 8, 2019

This pull request introduces 1 alert when merging bbb1888 into 8e12e5f - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@jsnellbaker jsnellbaker self-assigned this Dec 12, 2019
@lgtm-com
Copy link

lgtm-com bot commented Dec 13, 2019

This pull request introduces 1 alert when merging 043626d into b615862 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 13, 2019

This pull request introduces 1 alert when merging 4c20b1b into b615862 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

const keys = Object.keys(config);
if (!(includes(keys, 'minViewPort') && includes(keys, 'sizes'))) {
logError(`Ad Unit: ${adUnit.code}: mediaTypes.banner.sizeConfig is missing required property minViewPort or sizes or both. Removing the invalid mediaTypes.banner from Ad Unit.`);
return delete adUnit.mediaTypes.banner;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given this block of code exists in a forEach, if one of the configs were 'bad' - it would still keep looping through even though the parent mediaTypes.banner object should have been deleted. If that's not expected, could you take another look at the logic here (and probably later in the function).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsnellbaker Hi, I made the change.
I needed some way to display the log messages, and also delete the banner/video mediaType. I've made a change, let me know if that's fine.

@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2019

This pull request introduces 1 alert when merging f0a29ca into 1a5c9c1 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 19, 2019

This pull request introduces 1 alert when merging 2165a8b into 927d36e - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

if (bid.sizeConfig) {
const relevantMediaTypes = getRelevantMediaTypesForBidder(bid.sizeConfig, activeViewport);
if (relevantMediaTypes.length === 0) {
logError(`SizeMappingV2:: Bidder: ${bid.bidder} in Ad Unit: ${adUnit.code} has not configured sizeConfig property correctly. This bidder won't be eligible for sizeConfig checks and will remain active.`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This may be a minor thing, but could you flip the order of the adUnit and bidder in these log messages (and below this point)?

The majority of the messages earlier in the code use adUnit > bidder type of listing, so the switch here to bidder > adUnit is a bit distracting when looking at all the console messages together in the browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change. Please have a look.

return bids;
}
} else {
logInfo(`SizeMappingV2:: Bidder: ${bid.bidder} in Ad Unit: ${adUnit.code} is disabled due to failing sizeConfig check.`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This message should only show when the bidder has the relevantMediaTypes field set to none for this size tier correct? If so, can we update the message to be more reflecting of that condition?

The current message feels like they did something wrong in their setup, rather than it be the result of a choice they made.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change.

@lgtm-com
Copy link

lgtm-com bot commented Dec 20, 2019

This pull request introduces 1 alert when merging 5afc8d1 into c147d0d - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 26, 2019

This pull request introduces 1 alert when merging 66a43c5 into 88b6a6d - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 26, 2019

This pull request introduces 1 alert when merging b4cf490 into 88b6a6d - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Dec 31, 2019

This pull request introduces 1 alert when merging 57c27e6 into c81ea5c - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 2, 2020

This pull request introduces 1 alert when merging 7a02628 into 8386a33 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 3, 2020

This pull request introduces 2 alerts when merging 72b69df into c015d79 - view on LGTM.com

new alerts:

  • 2 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 4, 2020

This pull request introduces 2 alerts when merging ce36722 into c015d79 - view on LGTM.com

new alerts:

  • 2 for Useless assignment to local variable

@Fawke Fawke closed this Jan 6, 2020
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.

2 participants