Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

400 Bad Request with Google AdSense

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?

like image 734
user276289 Avatar asked Oct 02 '13 14:10

user276289


People also ask

Why am I getting a 400 error in Google?

Error 400 is a client error that occurs due to incorrect requests, invalid syntax, or routing issues. It can also occur if the URL is not recognized or you did not type it correctly. So, check again and make sure you typed the URL correctly.

What causes a 400 Bad Request?

The HTTP error 400 can occur due to incorrectly typed URL, malformed syntax, or a URL that contains illegal characters. This is surprisingly easy to do by mistake and can happen if a URL has been encoding incorrectly.

How do I fix AdSense errors?

Review the AdSense Program policies to make sure your site is in compliance. Keep in mind that we may review all pages of your site, not just the sign-up URL where you placed the code. After you've adjusted your content, sign in to AdSense and confirm that you've resolved the issues on your site.


1 Answers

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.

like image 187
Robert Sinclair Avatar answered Sep 23 '22 15:09

Robert Sinclair