INN / doubleclick-for-wp

WordPress plugin for serving Google Ad Manager ads
https://wordpress.org/plugins/doubleclick-for-wp/
GNU General Public License v2.0
25 stars 11 forks source link

Invalid arguments: SizeMappingBuilder.addSize(['0', 1], [[320, 50]]) #20

Closed benlk closed 7 years ago

benlk commented 7 years ago

Here's the full set of logs as seen in ?googlfc:

Start   Created slot: /65246486/banner_top_0
Information Start   Google service JS loaded
Information Start   Created service: publisher_ads
Information 1 ms    Associated service "publisher_ads" with slot "/65246486/banner_top".
Warning 2 ms    Invalid arguments: SizeMappingBuilder.addSize(['1220', 1], [[768, 90]])
Warning 2 ms    Invalid arguments: SizeMappingBuilder.addSize(['1040', 1], [[768, 90]])
Warning 2 ms    Invalid arguments: SizeMappingBuilder.addSize(['720', 1], [[320, 50]])
Warning 2 ms    Invalid arguments: SizeMappingBuilder.addSize(['0', 1], [[320, 50]])
Warning 2 ms    Size mapping is null because invalid mappings were added
Warning 4 ms    Error in processing size mapping: Size mapping has to be an array
Information 5 ms    Using single request mode to fetch ads.
Information 5 ms    Setting targeting attribute inURL with value /rivard-the-time-to-invest-in-mass-transit-is-now,/ for service publisher_ads
Information 5 ms    Setting targeting attribute URLIs with value /rivard-the-time-to-invest-in-mass-transit-is-now for service publisher_ads
Information 5 ms    Setting targeting attribute Query with value rivard-the-time-to-invest-in-mass-transit-is-now for service publisher_ads
Information 5 ms    Setting targeting attribute Domain with value rrlargo.wpengine.com for service publisher_ads
Information 5 ms    Setting targeting attribute Page with value single for service publisher_ads
Information 5 ms    Setting targeting attribute Category with value city-planning-development,gov-politics,transportation for service publisher_ads
Information 5 ms    Setting targeting attribute Tag with value brt-in-san-antonio,hov-lanes-in-san-antonio,multimodal-transit-in-san-antonio,sa-tomorrow-multimodal-transportation-plan,via-metropolitan-transit,vias-vision-2040 for service publisher_ads
Information 7 ms    GPT implementation fetched.
Information 10 ms   Calling fillslot.
Information 42 ms   Fetching ad for slot: /65246486/banner_top
Information 58 ms   Invoked queued function. Total: 3. Errors: 0.
Information 1638 ms Page load complete

Ads are failing to load, apparently because something is wrong with the arguments being passed to googletag.SizeMappingBuilder.addSize.

Is this because of a configuration error with the widget, or because of something actually being different?

screen shot 2016-07-26 at 11 35 36 pm screen shot 2016-07-26 at 11 36 12 pm
benlk commented 7 years ago

We're going to want a dump of the $args here: https://github.com/INN/DoubleClick-for-WordPress/blob/master/dfw-init.php#L103-L112

And a dump of what's actually coming out of new DoubleClickBreakpoint here: https://github.com/INN/DoubleClick-for-WordPress/blob/master/dfw-init.php#L122

benlk commented 7 years ago

A dump of what's coming out of new DoubleClickBreakpoint, which appears to indicate that the functionallity converting the objects to JSON is what's breaking the maxWidth, because the __set_state array is correct.

DoubleClickBreakpoint::__set_state(array(\n   'identifier' => 'xl',\n   'minWidth' => '1220',\n   'maxWidth' => '9999',\n   'option' => true,\n))
DoubleClickBreakpoint::__set_state(array(\n   'identifier' => 'desktop',\n   'minWidth' => '1040',\n   'maxWidth' => '1219',\n   'option' => true,\n))
DoubleClickBreakpoint::__set_state(array(\n   'identifier' => 'tablet',\n   'minWidth' => '720',\n   'maxWidth' => '1039',\n   'option' => true,\n))
DoubleClickBreakpoint::__set_state(array(\n   'identifier' => 'phone',\n   'minWidth' => '0',\n   'maxWidth' => '719',\n   'option' => true,\n))
benlk commented 7 years ago

This is where the 1 is coming from: https://github.com/INN/DoubleClick-for-WordPress/blob/master/dfw-init.php#L385

And reading between the lines of https://developers.google.com/doubleclick-gpt/reference#googletag.SizeMappingBuilder, the fiewport size is a minimum, so 1 is a minimum viewport-height of 1. I'm not sure what's making it invalid now. Does string '1' work?

benlk commented 7 years ago

Nope, string '1' does not work.

Warning Start   Invalid arguments: SizeMappingBuilder.addSize(['1220', '1'], [[728, 90]])
Warning Start   Invalid arguments: SizeMappingBuilder.addSize(['1040', '1'], [[728, 90]])
Warning Start   Invalid arguments: SizeMappingBuilder.addSize(['720', '1'], [[320, 50]])
Warning Start   Invalid arguments: SizeMappingBuilder.addSize(['0', '1'], [[320, 50]])

So is it the [[320,50]] double-bracketed array of arrays?

benlk commented 7 years ago
Warning 1 ms    Invalid arguments: SizeMappingBuilder.addSize(['1220', '1'], [728, 90])
Warning 1 ms    Invalid arguments: SizeMappingBuilder.addSize(['1040', '1'], [728, 90])
Warning 1 ms    Invalid arguments: SizeMappingBuilder.addSize(['720', '1'], [320, 50])
Warning 1 ms    Invalid arguments: SizeMappingBuilder.addSize(['0', '1'], [320, 50])

Nope.

Maybe it's because those are strings instead of ints?