nfl / react-gpt

A React display ad component using Google Publisher Tag
MIT License
145 stars 84 forks source link

googletag.defineSlot was called without a matching googletag.display call #28

Open chiel opened 7 years ago

chiel commented 7 years ago

Hi there - first off thanks for the great library. It looks really complete and supports all the features we need. Besides that it was also a breeze to implement.

However, I am getting a warning when re-rendering ads with the same slot name as previously used.

For example: I have an ad slot called GP-Left, on the first page render everything looks perfectly fine and the google console displays "Page tagged correctly" along with these messages:

Start   Invoked queued function. Total: 1. Errors: 0.
174 ms  Created slot: /xxxxxx/GP-Left_0
179 ms  Clearing slot targeting.
179 ms  Setting targeting attribute domaincode with value cz for slot /xxxxxx/GP-Left
179 ms  Google service JS loaded
179 ms  Created service: publisher_ads
180 ms  Associated service "publisher_ads" with slot "/xxxxxx/GP-Left".
181 ms  Created slot: /_0
181 ms  Associated service "publisher_ads" with slot "/".
251 ms  Page load complete
261 ms  GPT implementation fetched.
269 ms  Created service: companion_ads
273 ms  Destroyed slot: /_0
274 ms  Created service: content
278 ms  Calling fillslot.
299 ms  Fetching ad for slot: /xxxxxx/GP-Left
470 ms  Receiving ad for slot: /xxxxxx/GP-Left
471 ms  Rendering ad for slot: /xxxxxx/GP-Left
471 ms  Completed rendering ad for slot: /xxxxxx/GP-Left

Perfect.

However, when clicking through to another page, it shows me the warning:

GP-Left: googletag.defineSlot was called without a matching googletag.display call.

Along with the following logs:

74269 ms    Destroyed slot: /xxxxxx/GP-Left_0
74712 ms    Created slot: /xxxxxx/GP-Left_0
74713 ms    Clearing slot targeting.
74713 ms    Setting targeting attribute domaincode with value cz for slot /xxxxxx/GP-Left
74713 ms    Associated service "publisher_ads" with slot "/xxxxxx/GP-Left".
74715 ms    Calling fillslot.
74726 ms    Fetching ad for slot: /xxxxxx/GP-Left
75213 ms    Receiving ad for slot: /xxxxxx/GP-Left
75214 ms    Rendering ad for slot: /xxxxxx/GP-Left
75215 ms    Completed rendering ad for slot: /xxxxxx/GP-Left

The logs look just fine, and the page seems to be displaying just fine, so I'm not sure how much of an issue this is, or what's causing it.

This issue can be reproduced in the routing example if you disable single request mode. If you click around and hit the same page more than once, this error will manifest itself.

Could it have something to do with the generated slot name not being equal to the given slot name perhaps? I am not sure.

Either way, wanted to let you guys know - hit me up if you need a hand or want me to test something!

Cheers

jamsea commented 7 years ago

Thanks @chielkunkels, I'm having trouble recreating this. I commented out Gpt.enableSingleRequest(); in apps/routing/app.js but don't see the same issues in my chrome console. What url are you navigating to in Chrome? Did I miss something in your issue? Thanks!

chiel commented 7 years ago

Thanks for the reply @jamsea - are you checking in your actual chrome console? I wasn't too clear about it, but the console I meant is the Google Publisher Console. You can enable it by adding ?google_force_console=1 to the url, or through some other methods which may be found here: https://support.google.com/dfp_premium/answer/2462712

When you have that open and navigate around a bit (and hit a page the second time) you should see the warnings I described. Hope this helps, cheers!

randomBrain commented 6 years ago

Hi! Any progress with this? I have same issue and its appearing also when check document.getElementById is found, but still this error happens.