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

add adUnitCodes as param for setTargetingForAst() #3792

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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