N
N
nikitasius2015-03-11 02:02:03
Google
nikitasius, 2015-03-11 02:02:03

How to correctly place Google adsense (asynchronous code) on ajax site?

Good evening.
Such a problem with Google Adsense.

I'm using asynchronous code <script async...</script>- in a section <head>

<ins class="adsbygoogle"....</script>- inserted into a Div using Ajax (JS got the new content of the div, cleared the div with content and ads, then pasted).

After a couple of ad impressions, impressions are cut off.

Chrome console says

GET http://googleads.g.doubleclick.net...  400 (Bad Request)
.

I checked the request history
http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-....


Each time the prev_fmts variable wraps itself around.
prev_fmts=728x90&correlator=
prev_fmts=728x90%2C728x90&correlator=
prev_fmts=728x90%2C728x90%2C728x90&correlator=
prev_fmts=728x90%2C728x90%2C728x90%2C728x90&correlator=
prev_fmts=728x90%2C728x90%2C728x90%2C728x90%2C728x90&correlator=

On the last cheat, I get a 400 error.

During my work I have
Blocked a frame with origin "http://googleads.g.doubleclick.net" from accessing a frame with origin "http://адрес_моего_сайта". Protocols, domains, and ports must match.
, this problem on an Internet 6 years.

How should I place AND update asynchronous ads from Google on an Ajax site? If I place correctly, then with what crutches to fix the overflow prev_fmts?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nikitasius, 2015-03-11
@nikitasius

In general, what happens: You
can dynamically change ads only for DFP , and this is a completely different product from Google.
Here are the questions from stackoverflow.com ( first and second ).
The answers are short: you can't artificially update adsense ads on the same page. Why google does not distinguish between ajax navigation is their cockroaches and imperfection.
Solution to the problem: while it is forbidden - there is no solution.
An alternative is to use Google DFP (small business).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question