Skip to content

Instantly share code, notes, and snippets.

@mkendall07
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkendall07/8648d7cef66e05fe0d8f to your computer and use it in GitHub Desktop.
Save mkendall07/8648d7cef66e05fe0d8f to your computer and use it in GitHub Desktop.

pbjs

pbjs.getAdserverTargetingForAdUnitCode([adunitCode]) ⇒ object

This function returns the query string targeting parameters available at this moment for a given ad unit. Note that some bidder's response may not have been received if you call this function too quickly after the requests are sent.

Kind: static method of pbjs
Returns: object - returnObj return bids

Param Type Description
[adunitCode] string adUnitCode to get the bid responses for

pbjs.getAdserverTargeting() ⇒ object

returns all ad server targeting for all ad units

Kind: static method of pbjs
Returns: object - Map of adUnitCodes and targeting values []

pbjs.getBidResponses([adunitCode]) ⇒ object

This function returns the bid responses at the given moment.

Kind: static method of pbjs
Returns: object - map | object that contains the bidResponses

Param Type Description
[adunitCode] string adunitCode adUnitCode to get the bid responses for

pbjs.getBidResponsesForAdUnitCode(adUnitCode) ⇒ Object

Returns bidResponses for the specified adUnitCode

Kind: static method of pbjs
Returns: Object - bidResponse object

Param Type Description
adUnitCode String adUnitCode

pbjs.setTargetingForGPTAsync([codeArr])

Set query string targeting on all GPT ad units. The logic for deciding query strings is described in the section Configure AdServer Targeting. Note that this function has to be called after all ad units on page are defined.

Kind: static method of pbjs

Param Type Description
[codeArr] array an array of adUnitodes to set targeting for.

pbjs.allBidsAvailable() ⇒ bool

Returns a bool if all the bids have returned or timed out

Kind: static method of pbjs
Returns: bool - all bids available

pbjs.renderAd(doc, id)

This function will render the ad (based on params) in the given iframe document passed through. Note that doc SHOULD NOT be the parent document page as we can't doc.write() asynchrounsly

Kind: static method of pbjs

Param Type Description
doc object document
id string bid id to locate the ad

pbjs.removeAdUnit(adUnitCode)

Remove adUnit from the pbjs configuration

Kind: static method of pbjs

Param Type Description
adUnitCode String the adUnitCode to remove

pbjs.requestAllBids()

Request all bids configured in pbjs

Kind: static method of pbjs

pbjs.requestBids(requestObj)

Request bids ad-hoc. This function does not add or remove adUnits already configured.

Kind: static method of pbjs

Param Type Description
requestObj Object
requestObj.adUnitCodes Array.<string> adUnit codes to request. Use this or requestObj.adUnits
requestObj.adUnits Array.<object> AdUnitObjects to request. Use this or requestObj.adUnitCodes
[requestObj.timeout] number Timeout for requesting the bids specified in milliseconds
[requestObj.bidsBackHandler] function Callback to execute when all the bid responses are back or the timeout hits.

pbjs.addAdUnits(Array)

Add adunit(s)

Kind: static method of pbjs

Param Type Description
Array string | Array.<string> of adUnits or single adUnit Object.

pbjs.addCallback(event, func) ⇒ String

Add a callback event

Kind: static method of pbjs
Returns: String - id for callback

Param Type Description
event String event to attach callback to Options: "allRequestedBidsBack"
func function function to execute. Paramaters passed into the function: ((bidResObj

pbjs.removeCallback(cbId) ⇒ String

Remove a callback event

Kind: static method of pbjs
Returns: String - id for callback

Param Type Description
cbId string id of the callback to remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment