Skip to content

Commit

Permalink
QAds --> DFPads global
Browse files Browse the repository at this point in the history
  • Loading branch information
asuth committed Mar 14, 2011
1 parent b234f66 commit ba24fb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 44 deletions.
42 changes: 1 addition & 41 deletions README
@@ -1,41 +1 @@

Read background info at : http://www.sajalkayan.com/complete-asynchronous-ad-loading-using-dfp-and-labjs.html

Usage:-

Following variables need to be prepopulated.

1) DFPpubid = "ca-XXXXXX" - where XXXXXX is your adsense publisher id as seen on top right corner of adsense pages
2) adslots = An array with adobjects for ad locations

`
var DFPpubid = "ca-XXXXXX";
var adslots = [{"pubid": "ca-pub-XXXXXX", // pubid again
"slotname": "test_async_lb", // ad unit name from DFP
"width": 728, // width of ad unit
"height": 90, // height of ad unit
"target": "leaderboard" // id of the <div> to be populated with the ad
}, // repeat for as many ad units needed
{"pubid": "ca-pub-XXXXXX",
"slotname": "test_async_sky",
"width": 160,
"height": 600,
"target": "skyscraper"
}];
`

After the above 2 variables are populated, include the script using LABjs

$LAB.script("dfp-lab-iframe.js").wait(function(){
DFPasync(adslots, DFPpubid);
})


Warnings:-
1) Requires LABjs to be loaded - http://labjs.com/
2) Uses DFP's iframe method, so no expandable ads - http://www.google.com/support/dfp_sb/bin/answer.py?hl=en&answer=90777
3) This is a hack. If DFP changes their ad loading mechanisms this may break your site.
4) I don't confirm or deny if this script voilates any TOS.
5) Goto 1)

document.write is evil. It must die!
Still TODO
6 changes: 3 additions & 3 deletions dfp-lab-iframe.js
Expand Up @@ -17,11 +17,11 @@
}

function dfpReady() {
for (var i = 0, m = QAds.length; i < m; i++) {
displayAd(QAds[i]);
for (var i = 0, m = DFPads.length; i < m; i++) {
displayAd(DFPads[i]);
}

QAds = {
DFPads = {
push : function(slotname) {
myads.push(slotname);
displayAd(slotname);
Expand Down

0 comments on commit ba24fb2

Please sign in to comment.