From db4ad05fafdb292e11f6475656f4d4a03952b99c Mon Sep 17 00:00:00 2001 From: sumit116 Date: Thu, 2 May 2019 17:23:00 +0530 Subject: [PATCH] add adUnitCodes as param for setTargetingForAst() (#3792) --- src/prebid.js | 5 +++-- src/targeting.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index d475a715bbf..1b6a40aff97 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -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()); diff --git a/src/targeting.js b/src/targeting.js index 90897b8d956..6caa4029c9c 100644 --- a/src/targeting.js +++ b/src/targeting.js @@ -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();