0

如何在 ASP.NET 网站中添加谷歌分析?以及如何在 ASP.NET 网页中查看此报告。

4

1 回答 1

10

一步一步从谷歌; 5个简单的步骤:

1 - 首先创建一个谷歌分析帐户


2-您的网站作为网络资产添加到您正在使用的帐户中。


3- 在 Google Analytics 中,转到管理选项卡 > 配置文件 > 跟踪代码


4- 使用上一步中找到的代码创建一个新的 javascript 文件(看起来像这样):

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-Y']); // XXXXX-Y indicates the web property ID for your Analytics account
  _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);
  })();

5- 最后,将 javascript 文件包含到您的所有 asp 文件或母版页中(如果您使用的是一个:

<script src="myfolder/JS/GAnalytics.js" language="javascript" type="text/javascript" /> 
于 2012-08-31T11:57:10.690 回答