Skip to content

Commit

Permalink
fix some small typos for pbAdSlot exampe (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipStamenkovic authored May 18, 2020
1 parent e07564e commit bdfbbed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions features/pbAdSlot.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ var setPbAdSlot = function setPbAdSlot(adunits) {

// check if AdUnit.code has a div with a matching id value
const adUnitCodeDiv = document.getElementById(adUnit.code);
if (!adUnitCodeDiv) {
if (adUnitCodeDiv) {
// try to retrieve a data element from the div called data-adslotid.
if (adUnitCodeDiv.dataset.adslotid) {
adUnit.fpd.context.pbAdSlot = adUnitCodeDiv.dataset.adslotid;
return;
}
// Else if AdUnit.code matched a div and it's a banner mediaType and googletag is present
if (adUnit.mediaType && typeof adUnit.mediaType === 'object' && adUnit.mediaType.banner && adUnit.mediaTypes.banner.sizes && window.googletag && googletag.apiReady) {
if (adUnit.mediaTypes && typeof adUnit.mediaTypes === 'object' && adUnit.mediaTypes.banner && adUnit.mediaTypes.banner.sizes && window.googletag && googletag.apiReady) {
var gptSlots = googletag.pubads().getSlots();
// look up the GPT slot name from the div.
var linkedSlot = gptSlots.find(function (gptSlot) {
Expand All @@ -72,7 +72,7 @@ var setPbAdSlot = function setPbAdSlot(adunits) {
}
// Else, just use the AdUnit.code, assuming that it's an ad unit slot
adUnit.fpd.context.pbAdSlot = adUnit.code;
};
});
};

pbjs.onEvent('beforeRequestBids', setPbAdSlot);
Expand Down

0 comments on commit bdfbbed

Please sign in to comment.