如何添加谷歌分析在ASP.NET网站 [英] How to add google analytics in ASP.NET websites

查看:120
本文介绍了如何添加谷歌分析在ASP.NET网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to add google analytics in ASP.NET websites? And also how to see this reports in ASP.NET webpages.

推荐答案

一步的>;
5个简单步骤:

Step by step from Google; 5 easy steps:

1 - 首页<一个href=\"https://support.google.com/analytics/bin/answer.py?hl=en&topic=1006228&answer=1009694\">create一个谷歌Analytics帐户

1 - First create a google analytics account

2 - <一个href=\"https://support.google.com/analytics/bin/answer.py?hl=en&topic=1006228&answer=1042508\">Add您的网站的网络媒体资源为您正在使用的帐户。

2- Add your site as a web-property to the account you are using.

3。在谷歌分析,转到管理标签>模式>跟踪code

3- In Google Analytics, go to Admin tab > Profiles > Tracking Code

4-创建在previous步骤中找到的code一个新的JavaScript文件(看起来像这样的事情):

4- Create a new javascript file with the code found in the previous step (will look like something like this):

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文件或在你的母版页,如果您正在使用:


5- Finally, include the javascript file to all your asp files OR in your master page if you are using one:

<script src="myfolder/JS/GAnalytics.js" language="javascript" type="text/javascript" /> 

这篇关于如何添加谷歌分析在ASP.NET网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆