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

Fixes issue #2327 - getBidLandScapeTargeting not using adUnitCode argument #2336

Merged
merged 2 commits into from
Apr 3, 2018

Conversation

jsnellbaker
Copy link
Collaborator

Type of change

  • Bugfix

Description of change

Previously the getBidLandScapeTargeting function accepted an adUnitCodes argument, but it was never directly used inside the actual function. It's purpose was meant to provide the specific bids that match adUnitCode(s) (this param could be either a string or a list of strings).

This fix introduces the proper logic to use this argument. So now if a publisher wanted to apply the targeting data for a specific ad unit from their page code (as noted in the original issue), they could call (pbjs.setTargetingForGPTAsync('div-gpt-ad-1438287399331-0');) and it would only process that ad unit's data.

Other information

Fixes issue #2327

src/targeting.js Outdated
if (bid.adserverTargeting) {
if (
bid.adserverTargeting && adUnitCodes &&
((utils.isArray(adUnitCodes) && adUnitCodes.includes(bid.adUnitCode)) ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use includes by importing it from core-js
import includes from 'core-js/library/fn/array/includes';
Usage includes(<array>, <item>

includes doesn’t work in older versions of IE. The imported version is polyfilled to work with ie, rather than Babel doing any kind of transforms that might end up not working in target browsers

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the feedback; I just pushed a commit that switched it to the other includes function.

@jaiminpanchal27 jaiminpanchal27 added LGTM needs 2nd review Core module updates require two approvals from the core team and removed needs review labels Apr 3, 2018
@mkendall07 mkendall07 merged commit f463545 into master Apr 3, 2018
@mkendall07 mkendall07 deleted the bugfix/issue-2327-getBidLandScapeTargeting branch August 17, 2018 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM needs 2nd review Core module updates require two approvals from the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants