Ali Shafai
Ali Shafai

Reputation: 5161

How do I use Google Analytics in ASP.NET?

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.

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

Upvotes: 2

Views: 5364

Answers (5)

Doug
Doug

Reputation: 6518

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.

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

Upvotes: 2

Steven A. Lowe
Steven A. Lowe

Reputation: 61242

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.

see flash example

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

Upvotes: 1

oglester
oglester

Reputation: 6655

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

Upvotes: 0

Darryl Hein
Darryl Hein

Reputation: 145117

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.

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

Upvotes: 0

GEOCHET
GEOCHET

Reputation: 21323

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.

Upvotes: 0

Related Questions