Open
Description
In the sizeMapping array in window.dfw
, each individual mapping takes the form of an object/associative array with the keys browser
and ad_sizes
. Here's what jquery.dfp.js' docs say the plugin expects:
$('selector').dfp({
dfpID:'xxxxxxxxx',
sizeMapping: {
'my-default': [
{browser: [1024, 768], ad_sizes: [980, 185]},
{browser: [ 980, 600], ad_sizes: [[728, 90], [640, 480]]},
{browser: [ 0, 0], ad_sizes: [88, 31]}
],
}
});
Here's what this plugin is outputting upon the page, cleaned up to match the formatting:
window.dfw = {
"mappings": {
"mapping1": [
{ "browser": [ 1220, 1 ], "ad_sizes": [ [728,90] ] }
]
}
}
Two things are wrong here:
mappings
is notsizeMapping
- Because non-lazyload widgets are initialized off of
jQuery('.dfw-unit:not(.dfw-lazy-load)').dfp( window.dfw );
directly, there's no sizeMapping key set to provide sizes there.
Lazyload widgets are initialized off of window.dfp_options
, which is modified from window.dfw
:
doubleclick-for-wp/js/jquery.dfw.js
Lines 35 to 39 in f73e00d
There are several aspects to the fix for this:
- Change the localization to output
sizeMapping
rather than'mappings'
- make sure that lazy-load and non-lazy-load use the same source of configuration options: The not-lazy-load ad loader needs to wait until jQuery.dfp is available #95 encompasses this
As a temporary fix, sites affected can check the box to enable lazy-load for all widgets.