moyaya
V2EX  ›  Google

google大姨妈,导致使用了google analytics的页面加载特别慢

  •  
  •   moyaya · Oct 23, 2012 · 5750 views
    This topic created in 5140 days ago, the information mentioned may be changed or developed.
    今天去见VC,在展示网站的时候,发现网站的有二个页面死活打不开...囧

    回头研究了半天,发现这二个页面都是加载到99%不动了,极偶尔的情况下才能100%加载。

    而这二个列表页因为一些效果,加载的时候必须100%加载才能显示,才是发现是google analytics的问题,去掉了google analytics的代码后,显示就很快了。
    10 replies  •  1970-01-01 08:00:00 +08:00
    that5
    that5
    Oct 23, 2012
    1
    早就不使用统计了,再加上国内对g的特别招待,还能怎么样。
    dndx
    dndx
    Oct 23, 2012
    2
    为什么不用异步加载?
    moyaya
    moyaya
    OP
    Oct 23, 2012
    3
    @dndx 看了一下,好像用的就是最新的代码:

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-25712227-1']);
    _gaq.push(['_trackPageview']);

    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
    dndx
    dndx
    Oct 23, 2012
    4
    @moyaya 把代码放在<body/>前,不要放在<head>里试试呢?
    NemoAlex
    NemoAlex
    Oct 23, 2012
    5
    放哪里都没有用的,Google 在国内被墙,非常不稳定
    有两个办法:
    1. 把判断ssl的代码去掉,直接使用 https,不过这样会在非 https 页面不好
    2. 把 ga.js 文件放到你自己的服务器上用
    Livid
    Livid
    MOD
    PRO
    Oct 24, 2012
    6
    大家目前在访问 V2EX 的时候会遇到这样的问题么?
    zern
    zern
    Oct 24, 2012❤️1
    7
    会。。。
    Livid
    Livid
    MOD
    PRO
    Oct 24, 2012
    8
    @zern 多谢反馈。
    alex_ilex
    alex_ilex
    Oct 24, 2012
    9
    今天发现不用goagent,google都上不去了...
    TONYHEAD
    TONYHEAD
    Oct 24, 2012
    10
    把ga.js host在了自己的网站上。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2526 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 05:03 · PVG 13:03 · LAX 21:03 · JFK 00:03
    ♥ Do have faith in what you're doing.