Linux 谷歌分析会减慢我的网站速度吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3743648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 23:12:36  来源:igfitidea点击:

Does google analytics slow down my website?

javascripthtmllinuxstatisticsgoogle-analytics

提问by

I am at the final stages of my website, and currently I need to find a suitable statistics application/tool.

我正处于我网站的最后阶段,目前我需要找到合适的统计应用程序/工具。

I have looked into webalizer, but it seems outdated.

我已经研究过 webalizer,但它似乎已经过时了。

Also, I have looked into Google analytics, but I am afraid that if I implement it, my website will go slow. It is already pretty heavy with database material being displayed which is dynamic btw. I have read I can put the GA js code at the bottom of the page and thus the page will load first, but I still don't want a slow down.

另外,我已经研究过谷歌分析,但我担心如果我实施它,我的网站会变慢。顺便说一句,显示数据库材料已经很重了。我已经读过我可以将 GA js 代码放在页面底部,因此页面将首先加载,但我仍然不想放慢速度。

You are all much more experienced in statistics than I am, so I believe you can give me some good advice.

在统计方面,你们都比我更有经验,所以我相信你们可以给我一些很好的建议。

I have my own private server (Linux) and I have root access as well (offcourse).

我有自己的私人服务器(Linux),我也有 root 访问权限(当然)。

Do you think I should have a statistics app on the server, without interferring with my website, or should I go the Google way and use analytics?

您认为我应该在服务器上安装一个统计应用程序而不干扰我的网站,还是应该采用 Google 的方式并使用分析?

Please give me good application names which you have tested etc...

请给我您测试过的好的应用程序名称等...

Thanks

谢谢

采纳答案by Josh Leitzel

Any additional calls to scripts will slow down your site. However, Google Analytics instructs you to place it in a specific place so that it isn't loaded until the page has loaded. (It used to be before the </body>tag but I believe it's now supposed to be the last <script>in the <head>tag.) Don't worry about it too much; the benefits of analytics will far outweigh the extra call to a remote file.

对脚本的任何额外调用都会减慢您的网站速度。但是,Google Analytics 会指示您将其放置在特定位置,以便在页面加载之前不会加载它。(这曾经是前</body>标签,但我相信它现在应该是最后<script><head>标签。)不要担心太多; 分析的好处将远远超过对远程文件的额外调用。

Focus on other optimizations (database queries, CSS sprites, fewer HTTP requests). Analytics is necessary in today's site market and is indispensable; IMO it is not an option to forgo it.

专注于其他优化(数据库查询、CSS 精灵、更少的 HTTP 请求)。分析在当今的网站市场中必不可少,不可或缺;IMO 不能放弃它。

As far as having your own "statistics app," I assume you're talking about building your own proprietary statistics codebase? I would discourage that, because it takes a lotof time and effort and in the end you will not have the same optimizations that Google has employed an entire project's worth of software engineers to make. Remember that while it's always great to create your own product, you don't have to reinvent the wheel, especially when it comes to things like this that have many sensible drop-in solutions that are widely available for free.

至于拥有自己的“统计应用程序”,我假设您正在谈论构建自己的专有统计代码库?我不鼓励这样做,因为它需要花费大量的时间和精力,而且最终您将无法获得 Google 雇用整个项目的软件工程师进行的相同优化。请记住,虽然创建自己的产品总是很棒,但您不必重新发明轮子,尤其是当涉及到此类具有许多可广泛免费提供的合理插入式解决方案的事物时。

With respect to non-Google analytics solutions, one other of note is Clicky. I'm not as experienced with it as I am with GA, but I've heard many reviews that it is more precise and more informative than GA. However, just as an end-user browsing the web I've noticed a lot of times that its calls to Clicky's website dotend to slow down pages, and noticeably so; I cannot really say that I have seen the same effect with GA.

对于非 Google 分析解决方案,另一个值得注意的是Clicky。我不像 GA 那样有经验,但我听过很多评论说它比 GA 更精确、信息量更大。然而,就像浏览网页的最终用户一样,我多次注意到它对 Clicky 网站的调用确实会减慢页面速度,尤其是这样;我真的不能说我在 GA 上看到了同样的效果。

One last thing I would caution against is this: Do notemploy more than one analytics solution unless you are trying to find the best one to suit your needs. It's just overkill to run two remotely-hosted analytics solutions on every single one of your pages, so what I would encourage you to do is try out a few for the first few weeks or so of your site (yes, pages will slow down during this trial phase) and then simply stick with the one that you like best. That will also give you the added benefit of being able to see first-hand what the speed implications are on your unique hosting environment for each script.

我要告诫的最后一件事是:不要使用多个分析解决方案,除非您试图找到最适合您需求的解决方案。在您的每个页面上运行两个远程托管的分析解决方案简直是矫枉过正,所以我鼓励您做的是在网站的前几周左右尝试一些(是的,页面在这个试用阶段),然后只需坚持使用您最喜欢的那个。这还将为您提供额外的好处,即能够亲眼看到每个脚本对您的独特托管环境的速度影响。

Here's some other analytics solutions that you might check out:

以下是您可以查看的其他一些分析解决方案:

回答by vassilis

Google Analytics is javascript based and does not tun on your server. All processing and storage is done on Google servers, so it's ideal if you are worrying about local resources.

Google Analytics 是基于 javascript 的,不会在您的服务器上进行调整。所有处理和存储都在 Google 服务器上完成,因此如果您担心本地资源,这是理想的选择。

回答by racetrack

回答by James

People focus to much on total load times when what is important is render times and in particular progressive rendering. If you use Google Analytics properly, it will load after the page has shown to the user. So yes, it will add a small overhead to every request but because the user can see the page already they probably won't even notice. Just go for it.

当重要的是渲染时间,尤其是渐进式渲染时,人们会非常关注总加载时间。如果您正确使用 Google Analytics,它将在页面显示给用户后加载。所以是的,它会为每个请求增加一点开销,但因为用户已经可以看到页面,他们甚至可能不会注意到。去吧。

Webalizer runs on server side after apache logs doesn't it? That's why it appears outdated, it can't collect as much info as JS can. But it doesn't slow the user down any. You could run Webalizer and Google together for a bit and see what serves your needs best.

Webalizer 在 apache 日志后运行在服务器端,不是吗?这就是它看起来过时的原因,它不能像 JS 那样收集尽可能多的信息。但它不会减慢用户的速度。您可以将 Webalizer 和 Google 一起运行一段时间,看看什么最能满足您的需求。

回答by Jef Null

Straight from Google's analytic sign up page (https://www.google.com/analytics/provision/)

直接来自 Google 的分析注册页面 ( https://www.google.com/analytics/provision/)

"The appearance of your website will never be affected by your use of Google Analytics - we don't place any images or text on your pages. Likewise, the performance of your pages won't be impacted, with the possible exception of the very first page-load after you have added the tracking code. This first pageview calls the JavaScript on Google's servers, which may take slightly longer than a regular page load. Subsequent pageviews will use cached data and will not be affected."

“您网站的外观永远不会因您使用 Google Analytics(分析)而受到影响 - 我们不会在您的网页上放置任何图片或文字。同样,您网页的性能也不会受到影响,除非可能添加跟踪代码后的第一个页面加载。第一个页面浏览会调用 Google 服务器上的 JavaScript,这可能比常规页面加载时间稍长。后续的页面浏览将使用缓存数据,不会受到影响。”

回答by Andrew Kloos

We decided to work around the possibility of google's servers appearing to slow our site down. Instead of our users downloading the ga.js file from google's servers we store it locally. The only problem with that approach is that our local copy becomes outdated. So we wrote an application that periodically compares our local file to google's and updates our file accordingly.

我们决定解决谷歌服务器似乎会降低我们网站速度的可能性。我们的用户不是从谷歌的服务器下载 ga.js 文件,而是将其存储在本地。这种方法的唯一问题是我们的本地副本变得过时了。所以我们编写了一个应用程序,它会定期将我们的本地文件与谷歌的文件进行比较,并相应地更新我们的文件。

Andrew

安德鲁