43

I am running a website that uses AJAX requests and history.pushState for navigation.

The requested content code contains Google's asynchronus AdSense code:

<ins class="adsbygoogle"
     style="display:inline-block;width:468px;height:60px"
     data-ad-client="ca-pub-xxxxx"
     data-ad-slot="xxxxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

The head tag contains the adsbygoogle.js:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

This setup is working for one dynamically loaded pageview. After that, ads don't show up anymore. The error console shows:

400 (Bad Request) in expansion_embed.js:188

The expansion_embed.js requests the ad from http://googleads.g.doubleclick.net/pagead/ads. The requestet url contains lots of parameters.

Now, every time the ad does show up, the prev_fmts parameter has a value of 468x60. If the ad fails to load, this parameter's value is 486x60%2C468x60.

What is causing this parameter to change? Is it possible that this change is causing the 400 Bad Request errors?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user276289
  • 1,519
  • 2
  • 12
  • 14

4 Answers4

63

You just need to wait, when you first implement Adsense it will give this error. It took until next morning for Adsense to start displaying ads. I implemented their Responsive ad type.

Robert Sinclair
  • 4,550
  • 2
  • 44
  • 46
4

I was also getting same error when I added adsense code first time in my website. In my case, it started working simply after reloading page.

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
Balram Singh
  • 1,576
  • 19
  • 30
3

I had the same problem, and after some research, I've seen it's a problem of incompatibility between Google Adsens and AJAX sites.

See Google's announcement and these two threads in Google's forums.

I've tried to artifically mangle the prev_fmts parameter, but I couldn't find my way through the obfuscated JS. Anyway, I guess that doing this would go against Google Adsense TOS.

pau.moreno
  • 4,407
  • 3
  • 35
  • 37
-1

Adblock was blocking the ads. I Enabled the site to solved it.

Eyal
  • 4,653
  • 9
  • 40
  • 56