Skip to content

Commit

Permalink
add adUnitCodes as param for setTargetingForAst() (prebid#3792)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumit116 authored and jacekburys-quantcast committed May 15, 2019
1 parent 6364920 commit 5ef200a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,17 @@ $$PREBID_GLOBAL$$.setTargetingForGPTAsync = function (adUnit, customSlotMatching

/**
* Set query string targeting on all AST (AppNexus Seller Tag) ad units. Note that this function has to be called after all ad units on page are defined. For working example code, see [Using Prebid.js with AppNexus Publisher Ad Server](http://prebid.org/dev-docs/examples/use-prebid-with-appnexus-ad-server.html).
* @param {(string|string[])} adUnitCode adUnitCode or array of adUnitCodes
* @alias module:pbjs.setTargetingForAst
*/
$$PREBID_GLOBAL$$.setTargetingForAst = function() {
$$PREBID_GLOBAL$$.setTargetingForAst = function(adUnitCodes) {
utils.logInfo('Invoking $$PREBID_GLOBAL$$.setTargetingForAn', arguments);
if (!targeting.isApntagDefined()) {
utils.logError('window.apntag is not defined on the page');
return;
}

targeting.setTargetingForAst();
targeting.setTargetingForAst(adUnitCodes);

// emit event
events.emit(SET_TARGETING, targeting.getAllTargeting());
Expand Down
5 changes: 3 additions & 2 deletions src/targeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,11 @@ export function newTargeting(auctionManager) {
};

/**
* @param {(string|string[])} adUnitCode adUnitCode or array of adUnitCodes
* Sets targeting for AST
*/
targeting.setTargetingForAst = function() {
let astTargeting = targeting.getAllTargeting();
targeting.setTargetingForAst = function(adUnitCodes) {
let astTargeting = targeting.getAllTargeting(adUnitCodes);

try {
targeting.resetPresetTargetingAST();
Expand Down

0 comments on commit 5ef200a

Please sign in to comment.