Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
benlk opened this issue Feb 7, 2019 · 0 comments · May be fixed by #97
Labels
Milestone

Comments

@benlk
Copy link
Collaborator

benlk commented Feb 7, 2019

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.

@benlk benlk added the bug label Feb 7, 2019
@benlk benlk added this to the 0.3.1 milestone Feb 7, 2019
@benlk benlk changed the title non-lazyload ads are being loaded with incomplete options settings, and the mapping array non-lazyload ads are being loaded with incomplete options settings, and the mapping object's ad_sizes array is misformatted Feb 7, 2019
@benlk benlk linked a pull request Feb 7, 2019 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant