doubleclick-for-wp icon indicating copy to clipboard operation
doubleclick-for-wp copied to clipboard

Fix for non-lazy-load ads not displaying correctly

Open benlk opened this issue 6 years ago • 2 comments

Changes

  • Adds the indexes sizeMapping and setTargeting on the global window.dfw to match the parameters required by https://github.com/coop182/jquery.dfp.js#available-options
  • Moves the initialization of non-lazy-load ads into jquery.dfw.js, so that the code will hopefully only be loaded when jquery.dfp.min.js has been loaded, since jquery.dfw.js is listed as having jquery.dfp.min.js or jquery.dfp.js as a dependency.
  • Removes old copies of jquery.dfp.js from the repo, for https://github.com/INN/doubleclick-for-wp/issues/94

Why

  • Fixes #96, where non-lazy-load ads were being loaded with the wrong settings
  • Partially addresses #95, where an automatic optimization plugin was causing jquery.dfp.js to be loaded after the plugin function that used functionality defined in jquery.dfp.js. jquery.dfp is listed as a dependency of jquery.dfw in the enqueues, and Autoptimize was allowing lazy-load ads to load, so it seems that Autoptimize was loading ads in correct order. This changeset doesn't fix a potential future issue where jquery.dfp.js finishes loading before jquery.dfw does, but that seems unlikely if jquery.dfw is loaded later on the page than jquery.dfp, because they're loaded from the same origin.

For #95 and #96.

Resolves https://github.com/INN/doubleclick-for-wp/issues/94

Testing/Questions

Questions that need to be answered before merging:

  • [ ] Does it update the changelog in readme.txt with appropriate information?

Steps to test this PR:

  1. Create a non-lazy-load ad widget in the page, with size mappings.
  2. With version 0.3, verify that the plugin doesn't request a correct ad size
  3. With this PR, verify that the plugin does request a correct ad size .

benlk avatar Feb 07 '19 22:02 benlk

This PR may also address the following issues:

  • https://github.com/INN/doubleclick-for-wp/issues/90
  • https://wordpress.org/support/topic/do-not-use-version-0-3/
  • https://github.com/INN/doubleclick-for-wp/issues/92

benlk avatar Feb 07 '19 22:02 benlk

Test release of this plugin created: https://github.com/INN/doubleclick-for-wp/archive/v0.3.1-rc1.zip

Submitted to that one wp.org user for testing: https://wordpress.org/support/topic/do-not-use-version-0-3/#post-11181996

benlk avatar Feb 07 '19 23:02 benlk