coop182 / jquery.dfp.js

A jQuery implementation for Google DoubleClick for Publishers (DFP)
MIT License
278 stars 91 forks source link

Dynamically inserted ads rarely load. #107

Closed lukechilds closed 9 years ago

lukechilds commented 9 years ago

I have the following code running on page load to load all ads:

function loadAds() {
    $('.advert:not(.loaded)').dfp({
        dfpID: 'xxxxxxxx',
        enableSingleRequest: false,
        sizeMapping: sizeMaps
    }).addClass('loaded');
}
loadAds();

When some ajax requests return, more ads are added to the page and the loadAds() function is called again. For some reason, the ads added after page load very often do not get rendered. I'd say about 90% of the time they fail. All the ads on pageload work 100% of the time.

lukechilds commented 9 years ago

Oops never mind, I was trying to reuse the same placement ID. Keep up the good work!