Asynchronous non-blocking ad serving using DoubleClick for Publishers and LABjs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Read background info at :


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

      DFPasync(adslots, DFPpubid);

1) Requires LABjs to be loaded -
2) Uses DFP's iframe method, so no expandable ads -
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!