Skip to content

non-lazyload ads are being loaded with incomplete options settings, and the mapping object's ad_sizes array is misformatted #96

Open
@benlk

Description

@benlk

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 not sizeMapping
  • 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:

dfp_options = Object.assign( dfw, {
"collapseEmptyDivs": false,
"sizeMapping": dfw.mappings,
"setTargeting": dfw.targeting
});

There are several aspects to the fix for this:

As a temporary fix, sites affected can check the box to enable lazy-load for all widgets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions