V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
moyaya
V2EX  ›  Google

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

  •  
  •   moyaya · 2012 年 10 月 23 日 · 5272 次点击
    这是一个创建于 4848 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天去见VC,在展示网站的时候,发现网站的有二个页面死活打不开...囧

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

    而这二个列表页因为一些效果,加载的时候必须100%加载才能显示,才是发现是google analytics的问题,去掉了google analytics的代码后,显示就很快了。
    10 条回复    1970-01-01 08:00:00 +08:00
    that5
        1
    that5  
       2012 年 10 月 23 日
    早就不使用统计了,再加上国内对g的特别招待,还能怎么样。
    dndx
        2
    dndx  
       2012 年 10 月 23 日
    为什么不用异步加载?
    moyaya
        3
    moyaya  
    OP
       2012 年 10 月 23 日
    @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
        4
    dndx  
       2012 年 10 月 23 日
    @moyaya 把代码放在<body/>前,不要放在<head>里试试呢?
    NemoAlex
        5
    NemoAlex  
       2012 年 10 月 23 日
    放哪里都没有用的,Google 在国内被墙,非常不稳定
    有两个办法:
    1. 把判断ssl的代码去掉,直接使用 https,不过这样会在非 https 页面不好
    2. 把 ga.js 文件放到你自己的服务器上用
    Livid
        6
    Livid  
    MOD
    PRO
       2012 年 10 月 24 日
    大家目前在访问 V2EX 的时候会遇到这样的问题么?
    zern
        7
    zern  
       2012 年 10 月 24 日   ❤️ 1
    会。。。
    Livid
        8
    Livid  
    MOD
    PRO
       2012 年 10 月 24 日
    @zern 多谢反馈。
    alex_ilex
        9
    alex_ilex  
       2012 年 10 月 24 日
    今天发现不用goagent,google都上不去了...
    TONYHEAD
        10
    TONYHEAD  
       2012 年 10 月 24 日
    把ga.js host在了自己的网站上。
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1180 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:10 · PVG 02:10 · LAX 10:10 · JFK 13:10
    ♥ Do have faith in what you're doing.