如何在ASP.NET中使用Google Analytics?

时间:2022-06-01 20:49:45

I have a web page in which people go to register for my site. I use server side validation to authenticate them. I need to call some Javascript to tell GA that user was or was not registered. Later I need stats on success in registration.

我有一个网页,人们可以在其中注册我的网站。我使用服务器端验证来验证它们。我需要调用一些Javascript告诉GA用户是否注册。后来我需要注册成功的统计数据。

How can I call the GA function on my server side C# code?

如何在服务器端C#代码上调用GA功能?

5 个解决方案

#1


0  

I don't think Google Analytics is set up to do what you are trying to do. You should just be pasting the code into your master page. From there, you should be able to get a good idea of how many people have registered based on how many visited the landing page after they register.

我不认为Google Analytics(分析)设置为执行您要执行的操作。您应该将代码粘贴到母版页中。从那里,你应该能够很好地了解有多少人根据登记后登陆页面的访问量登记了多少人。

#2


2  

A project i have released under open source allows for easy integration with Google Analytics from .net native code to fire page views, events etc through code.

我在开源下发布的项目允许从.net本机代码轻松集成Google Analytics,以通过代码触发页面视图,事件等。

It's called GaDotNet and can be found here: http://www.diaryofaninja.com/projects/details/ga-dot-net

它叫做GaDotNet,可以在这里找到:http://www.diaryofaninja.com/projects/details/ga-dot-net

#3


1  

Rich B is correct, google analytics is triggered by client-side javascript. I saw the comment about Flash demonstrations, but bear in mind that Flash executes on the client.

Rich B是正确的,谷歌分析是由客户端javascript触发的。我看到了关于Flash演示的评论,但请记住Flash在客户端上执行。

see flash example

看flash的例子

you will need to emit some javascript to the client on a successful registration that simulates the goal page (like in the flash example)

您需要在模拟目标页面的成功注册时向客户端发出一些javascript(如在flash示例中)

#4


0  

Paste the code Google gives you into your footer or template that is displayed on every page or each of the individual templates if you don't have a footer.

如果您没有页脚,请将Google提供的代码粘贴到每个页面或每个模板上显示的页脚或模板中。

Then you can setup "conversion goals" on the pages where users end up when they are successful or not successful.

然后,您可以在用户成功或不成功的页面上设置“转换目标”。

If you just want to track how many, it would probably be easier to just store it in your own database.

如果您只想跟踪多少,可能更容易将其存储在您自己的数据库中。

BTW, Google Analytics doesn't work like you are thinking. It's all based on hits to pages and/or get/post parameters

顺便说一下,谷歌分析并不像你想的那样有效。这一切都基于对页面的点击和/或获取/发布参数

#5


0  

I don't know about Google Analytics, but I have used "beacons"

我不知道谷歌分析,但我用过“信标”

The info on this URL looks promising http://code.google.com/apis/analytics/docs/gaJSApiEcommerce.html

有关此网址的信息很有希望http://code.google.com/apis/analytics/docs/gaJSApiEcommerce.html

#1


0  

I don't think Google Analytics is set up to do what you are trying to do. You should just be pasting the code into your master page. From there, you should be able to get a good idea of how many people have registered based on how many visited the landing page after they register.

我不认为Google Analytics(分析)设置为执行您要执行的操作。您应该将代码粘贴到母版页中。从那里,你应该能够很好地了解有多少人根据登记后登陆页面的访问量登记了多少人。

#2


2  

A project i have released under open source allows for easy integration with Google Analytics from .net native code to fire page views, events etc through code.

我在开源下发布的项目允许从.net本机代码轻松集成Google Analytics,以通过代码触发页面视图,事件等。

It's called GaDotNet and can be found here: http://www.diaryofaninja.com/projects/details/ga-dot-net

它叫做GaDotNet,可以在这里找到:http://www.diaryofaninja.com/projects/details/ga-dot-net

#3


1  

Rich B is correct, google analytics is triggered by client-side javascript. I saw the comment about Flash demonstrations, but bear in mind that Flash executes on the client.

Rich B是正确的,谷歌分析是由客户端javascript触发的。我看到了关于Flash演示的评论,但请记住Flash在客户端上执行。

see flash example

看flash的例子

you will need to emit some javascript to the client on a successful registration that simulates the goal page (like in the flash example)

您需要在模拟目标页面的成功注册时向客户端发出一些javascript(如在flash示例中)

#4


0  

Paste the code Google gives you into your footer or template that is displayed on every page or each of the individual templates if you don't have a footer.

如果您没有页脚,请将Google提供的代码粘贴到每个页面或每个模板上显示的页脚或模板中。

Then you can setup "conversion goals" on the pages where users end up when they are successful or not successful.

然后,您可以在用户成功或不成功的页面上设置“转换目标”。

If you just want to track how many, it would probably be easier to just store it in your own database.

如果您只想跟踪多少,可能更容易将其存储在您自己的数据库中。

BTW, Google Analytics doesn't work like you are thinking. It's all based on hits to pages and/or get/post parameters

顺便说一下,谷歌分析并不像你想的那样有效。这一切都基于对页面的点击和/或获取/发布参数

#5


0  

I don't know about Google Analytics, but I have used "beacons"

我不知道谷歌分析,但我用过“信标”

The info on this URL looks promising http://code.google.com/apis/analytics/docs/gaJSApiEcommerce.html

有关此网址的信息很有希望http://code.google.com/apis/analytics/docs/gaJSApiEcommerce.html