douhan4243 2014-03-04 14:28
浏览 33
已采纳

谷歌广告的错误

I have a PHP website with mobile version and google ads are displayed there. I have received google code from my client for the header and the footer, respectively, and they are not always displaying. I receive a lot of warnings in the automatic error reports looking like this:

fopen(http://pagead2.googlesyndication.com/pagead/ads?...): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

After the question mark in the URL there are some parameters with private information, so I decided to write ... instead of them. I have asked my client to regenerate the codes and he has done so, I have pasted the new code for the header and the footer too, however, when we thought the error is gone we decided to call it a day and after 16 hours I have received 4352 error reports, 95% of them was with google ads, the error being the same, namely: failed to open stream. I wonder why do we see sometimes the ads and why are they not showing up in other cases. Question: When you guys have this errors, what are the steps to get rid of them and show the ads? (Of course I can take out the ads, but then my client would be unhappy, LOL)

EDIT: This is part of the code (confidential information was taken out from it and replaced with 'secret'). I hope that the question makes more sense now.

$GLOBALS['google']['client']='secret';
$GLOBALS['google']['https']=read_global('HTTPS');
$GLOBALS['google']['ip']=read_global('REMOTE_ADDR');
$GLOBALS['google']['markup']='xhtml';
$GLOBALS['google']['output']='xhtml';
$GLOBALS['google']['ref']=read_global('HTTP_REFERER');
$GLOBALS['google']['slotname']='secret';
$GLOBALS['google']['url']=read_global('HTTP_HOST') . read_global('REQUEST_URI');
$GLOBALS['google']['useragent']=read_global('HTTP_USER_AGENT');
  • 写回答

3条回答 默认 最新

  • douju7503 2014-03-14 02:36
    关注

    Since the errors you mention are on a remote server, Id try to test that server as much as possible.

    I'd try to discard a problem with my endpoint, which includes my ISP, my browser, firewall and proxy. After that, I'd try to test the other endpoint.

    First, try to look for a pattern on the error logs, try to find if it happens because to many connection in a short time, requests from s specific location, old browser, specific version of browser, etc.

    Too many connections on a short time period

    This should not be a problem for Google servers, but it may indicate a strange situation and some requests may not be getting the normal or complete HTTP response. You can not really test for this, but you can try to detect it and react.

    Old browser - Specific version of browser

    May be a bug on the browser is sending an incomplete request, which by coincidence happens to be an invalid one and that points to a non-existent resource. May be the browser has a cache defect and is sending the 404 response without even checking the resource. You test this by using at least two different browsers and private session, that way you discard browser problems, caching and cookies. (This works only for JS).

    Requests originated on a specific location

    That location may have connection problems, or a defective ISP, or an overzealous caching service, or a problematic proxy. You can not test this, but you can try to detect it and react, for instance, not sending ads to those requests.

    Firewall - proxy

    Is your client's site name similar to a banned/blocked one? If so, and if by coincidence on a server has happened a typo, you may be affected each time a request passes though. Check on lists of banned sites.

    Overload on your clients server

    Is your client's site hosted on a shared hosting, or a hosting that may be overused? If so, strange behaviours may happen, for instance related to execution time limit of the command, or because it stablishes too many connections and some have to be dropped out, leaving some connection just hanging and waiting for answer. This is difficult to test, but you can check the server load, do a reverse IP check to see if there are many clients sharing the same IP, do cURL requests and check average time.

    Time limit - redirections

    There are different time limits on a whole connection process. You can check if there is a problem with this, at least from your system as user and from your client's server. Create a PHP file with a cURL session (fresh connection each time and reusing connection), execute it many times, and check the response time and redirections. Check if you always get the right response from the service, if it takes too long, if there are redirections, if there are redirections every time or just some times, test a different times.

    EDIT (from Lajos Árpád)

    Ad size mismatch

    The code might be applicable for a given size, while you might use a different size. You should try to get information from your client about the issue.

    Setting mismatch

    This is a more general case for the above, but I described the problem of ad size independently, because ad size mismatch often occurs and it might be the real problem. Also, you should check whether the other important settings match, is there an issue with mishandling of something.

    END OF EDIT

    In my opinion, this should give you the answer you are looking for, and if it doesn't, you can provide more details on this question that can be useful for somebody else or use the results to ask/report on Google.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题