Can someone explain me how set up hb with Pubmatic?
I've been struggling to understand what am I doing wrong here. I've already set up a line item in DFP. But it seems that I'm doing something wrong... Here's the code I'm trying to use on my website:
<script>
var PREBID_TIMEOUT = 1000;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
function initAdserver() {
if (pbjs.initAdserverSet) return;
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
pbjs.initAdserverSet = true;
};
setTimeout(initAdserver, PREBID_TIMEOUT);
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
(function() {
var pbjsEl = document.createElement("script");
pbjsEl.type = "text/javascript";
pbjsEl.async = true;
pbjsEl.src = "//acdn.adnxs.com/prebid/static/0.4.1/prebid.js";
var pbjsTargetEl = document.getElementsByTagName("head")[0];
pbjsTargetEl.insertBefore(pbjsEl, pbjsTargetEl.firstChild);
})();
pbjs.que.push(function() {
var adUnits = [{
code: 'opecTeste_SB',
sizes: [300, 250],
bids: [{
bidder: 'appnexus',
params: { placementId: '4799418' }
}, {
bidder: 'pubmatic',
params: {
publisherId: '87624',
adSlot: '558879'
}
}]
}];
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function(bidResponses) {
initAdserver();
}
})
});
</script>
<script>
googletag.cmd.push(function() {
var rightSlot = googletag.defineSlot('/8948849/opecTeste_SB', [300, 250], 'opecTeste_SB').addService(googletag.pubads());
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
});
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<h2>Prebid.js Basic Example</h2>
<h5>Div-1, 300x250</h5>
<div id='opecTeste_SB'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('opecTeste_SB'); });
</script>
</div>
The thing is: I'm not sure of what's the right value for "adSlot", right now I'm using the "kadId" which is generate with the pubmatic's ad tag.
The code is running on: http://guitadigital.com/larissa While the appnexus bid's response works just fine, the pubmatic doesn't seems to return any value.
Can someone help me?
Hi @minarini, PubMatic needs to whitelist your unique publisher ID to enable usage for your account. I suggest you reach out to your client service rep
Can anyone confirm minarini's comments regarding if adSlot, stated as required, is actually "kadId" ?
@minarini
Any luck with after contacting PubMatic? The param adSlot is mapped to a request object called pm_optimize_adslots that is read by PubMatic script. The ID can take the form of 12334455@300x250
Hope that helps.