does Google analytics make a major effect on time to download a static web page?

后端 未结 15 1321
臣服心动
臣服心动 2021-01-07 22:44

I understand that by simply adding a script to the end of the body tag of a html document one makes it processable by Google analytics. My question is, is this likely to hav

相关标签:
15条回答
  • 2021-01-07 23:21

    Remember that not every user has fast US based connections.

    If you are on a slow connection from a country outside the US, the difference is certainly noticeable.

    People running slower computers or browsers outside the norm (i.e. old versions, mobile phones etc) may all be affected by the javascript execution time.

    0 讨论(0)
  • 2021-01-07 23:22

    Even if you put Analytics code at the bottom of your code, from a users perspective the site hasn't loaded till the little blue bar at the bottom has gone away.

    This means that your site will 'feel' slower, depending on (surprise surprise) how laggy your users connection is. For Dialup users and users accessing your websites from abroad (where request lag is a higher concern) the extra request will definitely mean a slightly less responsive website.

    However, given that every image, every javascript file and any other embedded object is an additional request, if you're already using a rich website layout, this is no reason not to use analytics.

    0 讨论(0)
  • 2021-01-07 23:23

    Sometimes I experience lags in pages that use it. I can track the problem to GA since it's the only script waiting to get loaded. I know this shouldn't happen but with some page requests it does rather randomly. Not that it usually matters since the whole page is already loaded so you can start reading. But it becomes a small problem with pages that use ajax or generaly do stuff on document ready event. So I add it to my adlock filters.

    0 讨论(0)
  • 2021-01-07 23:25

    Edit: Google has released Asynchronous Tracking. I haven't tried it yet, but I guess that it addresses the issues listed below.

    I think Google Analytics can make a website slower because it does happe that ga.js takes noticably long to load, and this can cause some problems:

    • If you have a JavaScript that triggers on window.onload (that includes the old school <body onload=""> syntax), then it wont fire until the web page has downloade complety. Using something like jQuery's ready event might remedy this, though.

    • Most browsers do not fill in saved user names and passwords until the web page has loaded completely.

    • It is not easy for the average user to spot that a web page is simply waiting for the Analytics script to load, so they might be waiting for the little download animation to finish even though the page has essentially finished downloading.

    • You could follow niallbrowne's suggestion of downloading ga.js and serving from your own web server. But this should be a last resort, since ga.js is cached across web sites and only expires once a week.

    0 讨论(0)
  • 2021-01-07 23:26

    No.

    If you put it at the end it will be loaded last, so even if Googles servers are a bit slow your visitors will never notice.

    ga.js is 9.58k and a logging call is about 1.2k. The js will be cached after the first load (I guess even across sites?) so it's really negligible size wise.

    0 讨论(0)
  • 2021-01-07 23:29

    Personally I really can't see that there would be much of a difference at all, your browser would cache it after the first request and use it there after on each other page.

    The script is loaded at the very bottom of the page as well so everything else should already be loaded.

    0 讨论(0)
提交回复
热议问题