Comments (4)
Proposed solution:
Instead of using ad unit path
('/1234/Leaderboard'), we should use the slot element ID ('div-gpt-ad-5678-2') as the code
for prebid ad units.
For example:
var adUnits = [{
code: 'div-gpt-ad-5678-2',
sizes: [...]
bids: [...]
}]
If 2 prebid ad units for some reason share the same code (DFP slot element ID) in this case, we'll combine the 2 ad units' result bids together.
GPT has the function getSlotElementId()
that can be used to get an ad slot's element ID.
from prebid.js.
👍 this feature request, this is currently a blocking item for us.
from prebid.js.
Update: I have been fiddling around with the source code a bit and have been able to get two ads of different sizes using the same slot with the suggested method above.
var rightSlot = googletag.defineSlot('12345/slot/name', [[300, 250]], 'div1').addService(googletag.pubads());
var topSlot = googletag.defineSlot('12345/slot/name', [[728,90]], 'div2').addService(googletag.pubads());
with adUnits defined:
{
code: 'div1',
sizes: [[300, 250]],
bids: [
{
bidder: 'yieldbot',
params: {
psn: 'TOADD',
slot: 'TOADD'
}
}]
}
and
{
code: 'div2',
sizes: [[728, 90]],
bids: [
{
bidder: 'yieldbot',
params: {
psn: 'TOADD',
slot: 'TOADD'
}
}]
}
The necessary code change appears to be in prebid.js at setTargetingForAdUnitsGPTAsync
(on line 442). The for-loop contents can be replaced with:
var adUnitCode = slots[i].getSlotElementId();
if (adUnitCode) {
placementBids = getBidResponsesByAdUnit(adUnitCode);
setGPTAsyncTargeting(slots[i].getAdUnitPath(), slots[i], placementBids);
}
where the adUnitCode is now based on the SlotElementId as suggested, though the GPTAsyncTargeting is still based on the adUnitPath as it was previously.
I have added this to a forked PR #77
from prebid.js.
Thanks for the contributing. I will also update the code to reflect a fallback to getAdUnitPath()
if getSlotElementId()
is empty
from prebid.js.
Related Issues (20)
- Error: Writable stream closed prematurely HOT 1
- Ad is not being rendered on the html page. HOT 8
- Teads: AutoplayDetection causes fullscreen video on WKWebView HOT 23
- ORTB Converter: Bidder specific SCHAIN copied to source object HOT 2
- Request to support/read CHIPS cookies within Prebid HOT 4
- Prebid 9: Remove default topics module frame list HOT 2
- Yahoo Adapter reading video.placement and not video.plcmt (Prebid 9) HOT 1
- LiveIntent User ID Module: Eliminating live-connect NPM Dependency. HOT 1
- meta.dsa vs ext.dsa HOT 2
- Feature request: simple way to flush the bid cache HOT 1
- fledgeForGPT module may assume Prebid adunit.code matches GPT slot HOT 2
- Parrable id system: implement pause
- How to install prebid and build 5.20.4 HOT 1
- How to extract device openRTB object from in prebidJs adapter from prebid request HOT 3
- Prebid 9
- Prebid 9: complete Idward -> anonymized cutover
- Asteriobid Analytics module: brand confusion
- ortbConverter library should support GVL for aliases HOT 1
- Failing tests on `master` HOT 7
- Coveralls deprecated? Update coverage badge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prebid.js.