Answer the question
In order to leave comments, you need to log in
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)
. http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-....
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=
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. prev_fmts
?
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question